Skip to content

Commit

Permalink
feat(rdb): acl simplified (#3577)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mia-Cross authored Jan 15, 2024
1 parent a8ddd43 commit e110d2d
Show file tree
Hide file tree
Showing 28 changed files with 12,741 additions and 969 deletions.
9 changes: 4 additions & 5 deletions cmd/scw/testdata/test-all-usage-rdb-acl-add-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
Add an additional ACL rule to a Database Instance.

USAGE:
scw rdb acl add [arg=value ...]
scw rdb acl add <acl-rule-ips ...> [arg=value ...]

ARGS:
instance-id UUID of the Database Instance you want to add ACL rules to
[rules.{index}.ip]
[rules.{index}.description]
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
acl-rule-ips IP addresses defined in the ACL rules of the Database Instance
instance-id ID of the Database Instance
[region=fr-par] Region to target. If none is passed will use default region from the config

FLAGS:
-h, --help help for add
Expand Down
8 changes: 4 additions & 4 deletions cmd/scw/testdata/test-all-usage-rdb-acl-delete-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
Delete one or more ACL rules of a Database Instance.

USAGE:
scw rdb acl delete [arg=value ...]
scw rdb acl delete <acl-rule-ips ...> [arg=value ...]

ARGS:
instance-id UUID of the Database Instance you want to delete an ACL rule from
rules.{index}.ip IP addresses defined in the ACL rules of the Database Instance
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
acl-rule-ips IP addresses defined in the ACL rules of the Database Instance
instance-id ID of the Database Instance
[region=fr-par] Region to target. If none is passed will use default region from the config

FLAGS:
-h, --help help for delete
Expand Down
2 changes: 1 addition & 1 deletion cmd/scw/testdata/test-all-usage-rdb-acl-edit-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ USAGE:
scw rdb acl edit <instance-id ...> [arg=value ...]

ARGS:
instance-id ID of the database instance
instance-id ID of the Database Instance
[mode=yaml] marshaling used when editing data (yaml | json)
[region=fr-par] Region to target. If none is passed will use default region from the config

Expand Down
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-all-usage-rdb-acl-set-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ARGS:

FLAGS:
-h, --help help for set
-w, --wait wait until the acl is ready

GLOBAL FLAGS:
-c, --config string The path to the config file
Expand Down
19 changes: 9 additions & 10 deletions docs/commands/rdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,17 @@ Add an additional ACL rule to a Database Instance.
**Usage:**

```
scw rdb acl add [arg=value ...]
scw rdb acl add <acl-rule-ips ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| instance-id | Required | UUID of the Database Instance you want to add ACL rules to |
| rules.{index}.ip | | |
| rules.{index}.description | | |
| 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 |
| acl-rule-ips | Required | IP addresses defined in the ACL rules of the Database Instance |
| instance-id | Required | ID of the Database Instance |
| region | Default: `fr-par` | Region to target. If none is passed will use default region from the config |



Expand All @@ -115,17 +114,17 @@ Delete one or more ACL rules of a Database Instance.
**Usage:**

```
scw rdb acl delete [arg=value ...]
scw rdb acl delete <acl-rule-ips ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| instance-id | Required | UUID of the Database Instance you want to delete an ACL rule from |
| rules.{index}.ip | Required | IP addresses defined in the ACL rules of the Database 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 |
| acl-rule-ips | Required | IP addresses defined in the ACL rules of the Database Instance |
| instance-id | Required | ID of the Database Instance |
| region | Default: `fr-par` | Region to target. If none is passed will use default region from the config |



Expand All @@ -145,7 +144,7 @@ scw rdb acl edit <instance-id ...> [arg=value ...]

| Name | | Description |
|------|---|-------------|
| instance-id | Required | ID of the database instance |
| instance-id | Required | ID of the Database Instance |
| mode | Default: `yaml`<br />One of: `yaml`, `json` | marshaling used when editing data |
| region | Default: `fr-par` | Region to target. If none is passed will use default region from the config |

Expand Down
3 changes: 3 additions & 0 deletions internal/namespaces/rdb/v1/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ func GetCommands() *core.Commands {
human.RegisterMarshalerFunc(rdb.BackupSchedule{}, backupScheduleMarshalerFunc)
human.RegisterMarshalerFunc(backupDownloadResult{}, backupResultMarshallerFunc)
human.RegisterMarshalerFunc(createInstanceResult{}, createInstanceResultMarshalerFunc)
human.RegisterMarshalerFunc(rdbACLCustomResult{}, rdbACLCustomResultMarshalerFunc)
human.RegisterMarshalerFunc(core.MultiResults{}, rdbACLCustomMultiResultMarshalerFunc)

human.RegisterMarshalerFunc(rdb.InstanceStatus(""), human.EnumMarshalFunc(instanceStatusMarshalSpecs))
human.RegisterMarshalerFunc(rdb.DatabaseBackupStatus(""), human.EnumMarshalFunc(backupStatusMarshalSpecs))
Expand All @@ -32,6 +34,7 @@ func GetCommands() *core.Commands {
))
cmds.MustFind("rdb", "acl", "add").Override(aclAddBuilder)
cmds.MustFind("rdb", "acl", "delete").Override(aclDeleteBuilder)
cmds.MustFind("rdb", "acl", "set").Override(aclSetBuilder)

cmds.MustFind("rdb", "backup", "create").Override(backupCreateBuilder)
cmds.MustFind("rdb", "backup", "export").Override(backupExportBuilder)
Expand Down
Loading

0 comments on commit e110d2d

Please sign in to comment.