Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yfodil committed Oct 17, 2022
1 parent 3af66ca commit 4635a1f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ ARGS:
[logs-policy.max-age-retention] Max age (in day) of remote logs to keep on the database instance
[logs-policy.total-disk-retention] Max disk size of remote logs to keep on the database instance
[backup-same-region] Store logical backups in the same region as the database instance
[settings.{index}.name] Settings of a given instance
[settings.{index}.value] Settings of a given instance
[settings.{index}.name] Setting name of a given instance
[settings.{index}.value] Setting value of a given instance
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

FLAGS:
Expand Down
22 changes: 22 additions & 0 deletions docs/commands/rdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,31 @@ scw rdb instance update <instance-id ...> [arg=value ...]
| logs-policy.max-age-retention | | Max age (in day) of remote logs to keep on the database instance |
| logs-policy.total-disk-retention | | Max disk size of remote logs to keep on the database instance |
| backup-same-region | | Store logical backups in the same region as the database instance |
| settings.{index}.name | | Setting name of a given instance |
| settings.{index}.value | | Setting value of a given instance |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |


**Examples:**


Update instance name
```
scw rdb instance update 11111111-1111-1111-1111-111111111111 name=foo --wait
```

Update instance tags
```
scw rdb instance update 11111111-1111-1111-1111-111111111111 tags.0=a --wait
```

Set a timezone
```
scw rdb instance update 11111111-1111-1111-1111-111111111111 settings.0.name=timezone settings.0.value=UTC --wait
```




### Upgrade an instance to an higher instance type

Expand Down
11 changes: 8 additions & 3 deletions internal/namespaces/rdb/v1/custom_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,14 @@ func instanceUpdateBuilder(c *core.Command) *core.Command {
},
{
Name: "settings.{index}.name",
Short: `Settings of a given instance`,
Short: `Setting name of a given instance`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "settings.{index}.value",
Short: `Settings of a given instance`,
Short: `Setting value of a given instance`,
Required: false,
Deprecated: false,
Positional: false,
Expand All @@ -278,6 +278,9 @@ func instanceUpdateBuilder(c *core.Command) *core.Command {
Region: customRequest.Region,
InstanceID: customRequest.InstanceID,
})
if err != nil {
return nil, err
}

if customRequest.Settings != nil {
settings := getResp.Settings
Expand Down Expand Up @@ -316,9 +319,11 @@ func instanceUpdateBuilder(c *core.Command) *core.Command {
Region: updateInstanceResponse.Region,
InstanceID: updateInstanceResponse.ID,
})
if err != nil {
return nil, err
}

return resp, nil

},
WaitFunc: func(ctx context.Context, argsI, respI interface{}) (interface{}, error) {
api := rdb.NewAPI(core.ExtractClient(ctx))
Expand Down

0 comments on commit 4635a1f

Please sign in to comment.