Skip to content

Commit e110d2d

Browse files
authored
feat(rdb): acl simplified (#3577)
1 parent a8ddd43 commit e110d2d

28 files changed

+12741
-969
lines changed

cmd/scw/testdata/test-all-usage-rdb-acl-add-usage.golden

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
Add an additional ACL rule to a Database Instance.
44

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

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

1413
FLAGS:
1514
-h, --help help for add

cmd/scw/testdata/test-all-usage-rdb-acl-delete-usage.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
Delete one or more ACL rules of a Database Instance.
44

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

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

1313
FLAGS:
1414
-h, --help help for delete

cmd/scw/testdata/test-all-usage-rdb-acl-edit-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ USAGE:
77
scw rdb acl edit <instance-id ...> [arg=value ...]
88

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

cmd/scw/testdata/test-all-usage-rdb-acl-set-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ARGS:
1313

1414
FLAGS:
1515
-h, --help help for set
16+
-w, --wait wait until the acl is ready
1617

1718
GLOBAL FLAGS:
1819
-c, --config string The path to the config file

docs/commands/rdb.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,17 @@ Add an additional ACL rule to a Database Instance.
9393
**Usage:**
9494

9595
```
96-
scw rdb acl add [arg=value ...]
96+
scw rdb acl add <acl-rule-ips ...> [arg=value ...]
9797
```
9898

9999

100100
**Args:**
101101

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

109108

110109

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

117116
```
118-
scw rdb acl delete [arg=value ...]
117+
scw rdb acl delete <acl-rule-ips ...> [arg=value ...]
119118
```
120119

121120

122121
**Args:**
123122

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

130129

131130

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

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

internal/namespaces/rdb/v1/custom.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ func GetCommands() *core.Commands {
1313
human.RegisterMarshalerFunc(rdb.BackupSchedule{}, backupScheduleMarshalerFunc)
1414
human.RegisterMarshalerFunc(backupDownloadResult{}, backupResultMarshallerFunc)
1515
human.RegisterMarshalerFunc(createInstanceResult{}, createInstanceResultMarshalerFunc)
16+
human.RegisterMarshalerFunc(rdbACLCustomResult{}, rdbACLCustomResultMarshalerFunc)
17+
human.RegisterMarshalerFunc(core.MultiResults{}, rdbACLCustomMultiResultMarshalerFunc)
1618

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

3639
cmds.MustFind("rdb", "backup", "create").Override(backupCreateBuilder)
3740
cmds.MustFind("rdb", "backup", "export").Override(backupExportBuilder)

0 commit comments

Comments
 (0)