Skip to content

Commit b71a60f

Browse files
feat(iam): add tags on applications, groups, users and policies (#3499)
Co-authored-by: Jules Castéran <[email protected]>
1 parent 61920a7 commit b71a60f

13 files changed

+102
-3
lines changed

cmd/scw/testdata/test-all-usage-iam-application-create-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ USAGE:
88
ARGS:
99
name=<generated> Name of the application to create (max length is 64 characters)
1010
[description] Description of the application (max length is 200 characters)
11+
[tags.{index}] Tags associated with the application (maximum of 10 tags)
1112
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
1213

1314
FLAGS:

cmd/scw/testdata/test-all-usage-iam-application-list-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ARGS:
1010
[name] Name of the application to filter
1111
[editable] Defines whether to filter out editable applications or not
1212
[application-ids.{index}] Filter by list of IDs
13+
[tag] Filter by tags containing a given string
1314
[organization-id=<retrieved from config>] Organization ID to use. If none is passed the default organization ID will be used
1415

1516
FLAGS:

cmd/scw/testdata/test-all-usage-iam-application-update-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ARGS:
99
application-id ID of the application to update
1010
[name] New name for the application (max length is 64 chars)
1111
[description] New description for the application (max length is 200 chars)
12+
[tags.{index}] New tags for the application (maximum of 10 tags)
1213

1314
FLAGS:
1415
-h, --help help for update

cmd/scw/testdata/test-all-usage-iam-group-create-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ EXAMPLES:
1212
ARGS:
1313
name=<generated> Name of the group to create (max length is 64 chars). MUST be unique inside an Organization
1414
[description] Description of the group to create (max length is 200 chars)
15+
[tags.{index}] Tags associated with the group (maximum of 10 tags)
1516
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
1617

1718
FLAGS:

cmd/scw/testdata/test-all-usage-iam-group-list-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ARGS:
1111
[application-ids.{index}] Filter by a list of application IDs
1212
[user-ids.{index}] Filter by a list of user IDs
1313
[group-ids.{index}] Filter by a list of group IDs
14+
[tag] Filter by tags containing a given string
1415
[organization-id=<retrieved from config>] Organization ID to use. If none is passed the default organization ID will be used
1516

1617
FLAGS:

cmd/scw/testdata/test-all-usage-iam-group-update-usage.golden

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ USAGE:
66
scw iam group update <group-id ...> [arg=value ...]
77

88
ARGS:
9-
group-id ID of the group to update
10-
[name] New name for the group (max length is 64 chars). MUST be unique inside an Organization
11-
[description] New description for the group (max length is 200 chars)
9+
group-id ID of the group to update
10+
[name] New name for the group (max length is 64 chars). MUST be unique inside an Organization
11+
[description] New description for the group (max length is 200 chars)
12+
[tags.{index}] New tags for the group (maximum of 10 tags)
1213

1314
FLAGS:
1415
-h, --help help for update

cmd/scw/testdata/test-all-usage-iam-policy-create-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ARGS:
1515
[rules.{index}.permission-set-names.{index}] Names of permission sets bound to the rule
1616
[rules.{index}.project-ids.{index}] List of Project IDs the rule is scoped to
1717
[rules.{index}.organization-id] ID of Organization the rule is scoped to
18+
[tags.{index}] Tags associated with the policy (maximum of 10 tags)
1819
[user-id] ID of user attributed to the policy
1920
[group-id] ID of group attributed to the policy
2021
[application-id] ID of application attributed to the policy

cmd/scw/testdata/test-all-usage-iam-policy-list-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ARGS:
1313
[application-ids.{index}] Filter by a list of application IDs
1414
[no-principal] Defines whether or not the policy is attributed to a principal
1515
[policy-name] Name of the policy to fetch
16+
[tag] Filter by tags containing a given string
1617
[organization-id=<retrieved from config>] Organization ID to use. If none is passed the default organization ID will be used
1718

1819
FLAGS:

cmd/scw/testdata/test-all-usage-iam-policy-update-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ARGS:
99
policy-id Id of policy to update
1010
[name] New name for the policy (max length is 64 characters)
1111
[description] New description of policy (max length is 200 characters)
12+
[tags.{index}] New tags for the policy (maximum of 10 tags)
1213
[user-id] New ID of user attributed to the policy
1314
[group-id] New ID of group attributed to the policy
1415
[application-id] New ID of application attributed to the policy

cmd/scw/testdata/test-all-usage-iam-user-create-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ USAGE:
77

88
ARGS:
99
email Email of the user
10+
[tags.{index}] Tags associated with the user
1011
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
1112

1213
FLAGS:

cmd/scw/testdata/test-all-usage-iam-user-list-usage.golden

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ARGS:
99
[order-by=created_at_asc] Criteria for sorting results (created_at_asc | created_at_desc | updated_at_asc | updated_at_desc | email_asc | email_desc | last_login_asc | last_login_desc)
1010
[user-ids.{index}] Filter by list of IDs
1111
[mfa] Filter by MFA status
12+
[tag] Filter by tags containing a given string
1213
organization-id=<retrieved from config> ID of the Organization to filter
1314

1415
FLAGS:

docs/commands/iam.md

+11
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ scw iam application create [arg=value ...]
201201
|------|---|-------------|
202202
| name | Required<br />Default: `<generated>` | Name of the application to create (max length is 64 characters) |
203203
| description | | Description of the application (max length is 200 characters) |
204+
| tags.{index} | | Tags associated with the application (maximum of 10 tags) |
204205
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |
205206

206207

@@ -262,6 +263,7 @@ scw iam application list [arg=value ...]
262263
| name | | Name of the application to filter |
263264
| editable | | Defines whether to filter out editable applications or not |
264265
| application-ids.{index} | | Filter by list of IDs |
266+
| tag | | Filter by tags containing a given string |
265267
| organization-id | Default: `<retrieved from config>` | Organization ID to use. If none is passed the default organization ID will be used |
266268

267269

@@ -284,6 +286,7 @@ scw iam application update <application-id ...> [arg=value ...]
284286
| application-id | Required | ID of the application to update |
285287
| name | | New name for the application (max length is 64 chars) |
286288
| description | | New description for the application (max length is 200 chars) |
289+
| tags.{index} | | New tags for the application (maximum of 10 tags) |
287290

288291

289292

@@ -351,6 +354,7 @@ scw iam group create [arg=value ...]
351354
|------|---|-------------|
352355
| name | Required<br />Default: `<generated>` | Name of the group to create (max length is 64 chars). MUST be unique inside an Organization |
353356
| description | | Description of the group to create (max length is 200 chars) |
357+
| tags.{index} | | Tags associated with the group (maximum of 10 tags) |
354358
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |
355359

356360

@@ -433,6 +437,7 @@ scw iam group list [arg=value ...]
433437
| application-ids.{index} | | Filter by a list of application IDs |
434438
| user-ids.{index} | | Filter by a list of user IDs |
435439
| group-ids.{index} | | Filter by a list of group IDs |
440+
| tag | | Filter by tags containing a given string |
436441
| organization-id | Default: `<retrieved from config>` | Organization ID to use. If none is passed the default organization ID will be used |
437442

438443

@@ -497,6 +502,7 @@ scw iam group update <group-id ...> [arg=value ...]
497502
| group-id | Required | ID of the group to update |
498503
| name | | New name for the group (max length is 64 chars). MUST be unique inside an Organization |
499504
| description | | New description for the group (max length is 200 chars) |
505+
| tags.{index} | | New tags for the group (maximum of 10 tags) |
500506

501507

502508

@@ -633,6 +639,7 @@ scw iam policy create [arg=value ...]
633639
| rules.{index}.permission-set-names.{index} | | Names of permission sets bound to the rule |
634640
| rules.{index}.project-ids.{index} | | List of Project IDs the rule is scoped to |
635641
| rules.{index}.organization-id | | ID of Organization the rule is scoped to |
642+
| tags.{index} | | Tags associated with the policy (maximum of 10 tags) |
636643
| user-id | | ID of user attributed to the policy |
637644
| group-id | | ID of group attributed to the policy |
638645
| application-id | | ID of application attributed to the policy |
@@ -711,6 +718,7 @@ scw iam policy list [arg=value ...]
711718
| application-ids.{index} | | Filter by a list of application IDs |
712719
| no-principal | | Defines whether or not the policy is attributed to a principal |
713720
| policy-name | | Name of the policy to fetch |
721+
| tag | | Filter by tags containing a given string |
714722
| organization-id | Default: `<retrieved from config>` | Organization ID to use. If none is passed the default organization ID will be used |
715723

716724

@@ -733,6 +741,7 @@ scw iam policy update <policy-id ...> [arg=value ...]
733741
| policy-id | Required | Id of policy to update |
734742
| name | | New name for the policy (max length is 64 characters) |
735743
| description | | New description of policy (max length is 200 characters) |
744+
| tags.{index} | | New tags for the policy (maximum of 10 tags) |
736745
| user-id | | New ID of user attributed to the policy |
737746
| group-id | | New ID of group attributed to the policy |
738747
| application-id | | New ID of application attributed to the policy |
@@ -947,6 +956,7 @@ scw iam user create [arg=value ...]
947956
| Name | | Description |
948957
|------|---|-------------|
949958
| email | Required | Email of the user |
959+
| tags.{index} | | Tags associated with the user |
950960
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |
951961

952962

@@ -1007,6 +1017,7 @@ scw iam user list [arg=value ...]
10071017
| order-by | Default: `created_at_asc`<br />One of: `created_at_asc`, `created_at_desc`, `updated_at_asc`, `updated_at_desc`, `email_asc`, `email_desc`, `last_login_asc`, `last_login_desc` | Criteria for sorting results |
10081018
| user-ids.{index} | | Filter by list of IDs |
10091019
| mfa | | Filter by MFA status |
1020+
| tag | | Filter by tags containing a given string |
10101021
| organization-id | Required<br />Default: `<retrieved from config>` | ID of the Organization to filter |
10111022

10121023

internal/namespaces/iam/v1alpha1/iam_cli.go

+77
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,13 @@ func iamUserList() *core.Command {
452452
Deprecated: false,
453453
Positional: false,
454454
},
455+
{
456+
Name: "tag",
457+
Short: `Filter by tags containing a given string`,
458+
Required: false,
459+
Deprecated: false,
460+
Positional: false,
461+
},
455462
{
456463
Name: "organization-id",
457464
Short: `ID of the Organization to filter`,
@@ -557,6 +564,13 @@ func iamUserCreate() *core.Command {
557564
Deprecated: false,
558565
Positional: false,
559566
},
567+
{
568+
Name: "tags.{index}",
569+
Short: `Tags associated with the user`,
570+
Required: false,
571+
Deprecated: false,
572+
Positional: false,
573+
},
560574
core.OrganizationIDArgSpec(),
561575
},
562576
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -610,6 +624,13 @@ func iamApplicationList() *core.Command {
610624
Deprecated: false,
611625
Positional: false,
612626
},
627+
{
628+
Name: "tag",
629+
Short: `Filter by tags containing a given string`,
630+
Required: false,
631+
Deprecated: false,
632+
Positional: false,
633+
},
613634
core.OrganizationIDArgSpec(),
614635
},
615636
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -653,6 +674,13 @@ func iamApplicationCreate() *core.Command {
653674
Deprecated: false,
654675
Positional: false,
655676
},
677+
{
678+
Name: "tags.{index}",
679+
Short: `Tags associated with the application (maximum of 10 tags)`,
680+
Required: false,
681+
Deprecated: false,
682+
Positional: false,
683+
},
656684
core.OrganizationIDArgSpec(),
657685
},
658686
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -726,6 +754,13 @@ func iamApplicationUpdate() *core.Command {
726754
Deprecated: false,
727755
Positional: false,
728756
},
757+
{
758+
Name: "tags.{index}",
759+
Short: `New tags for the application (maximum of 10 tags)`,
760+
Required: false,
761+
Deprecated: false,
762+
Positional: false,
763+
},
729764
},
730765
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
731766
request := args.(*iam.UpdateApplicationRequest)
@@ -820,6 +855,13 @@ func iamGroupList() *core.Command {
820855
Deprecated: false,
821856
Positional: false,
822857
},
858+
{
859+
Name: "tag",
860+
Short: `Filter by tags containing a given string`,
861+
Required: false,
862+
Deprecated: false,
863+
Positional: false,
864+
},
823865
core.OrganizationIDArgSpec(),
824866
},
825867
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -877,6 +919,13 @@ func iamGroupCreate() *core.Command {
877919
Deprecated: false,
878920
Positional: false,
879921
},
922+
{
923+
Name: "tags.{index}",
924+
Short: `Tags associated with the group (maximum of 10 tags)`,
925+
Required: false,
926+
Deprecated: false,
927+
Positional: false,
928+
},
880929
core.OrganizationIDArgSpec(),
881930
},
882931
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -970,6 +1019,13 @@ func iamGroupUpdate() *core.Command {
9701019
Deprecated: false,
9711020
Positional: false,
9721021
},
1022+
{
1023+
Name: "tags.{index}",
1024+
Short: `New tags for the group (maximum of 10 tags)`,
1025+
Required: false,
1026+
Deprecated: false,
1027+
Positional: false,
1028+
},
9731029
},
9741030
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
9751031
request := args.(*iam.UpdateGroupRequest)
@@ -1283,6 +1339,13 @@ func iamPolicyList() *core.Command {
12831339
Deprecated: false,
12841340
Positional: false,
12851341
},
1342+
{
1343+
Name: "tag",
1344+
Short: `Filter by tags containing a given string`,
1345+
Required: false,
1346+
Deprecated: false,
1347+
Positional: false,
1348+
},
12861349
core.OrganizationIDArgSpec(),
12871350
},
12881351
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
@@ -1347,6 +1410,13 @@ func iamPolicyCreate() *core.Command {
13471410
Deprecated: false,
13481411
Positional: false,
13491412
},
1413+
{
1414+
Name: "tags.{index}",
1415+
Short: `Tags associated with the policy (maximum of 10 tags)`,
1416+
Required: false,
1417+
Deprecated: false,
1418+
Positional: false,
1419+
},
13501420
{
13511421
Name: "user-id",
13521422
Short: `ID of user attributed to the policy`,
@@ -1454,6 +1524,13 @@ func iamPolicyUpdate() *core.Command {
14541524
Deprecated: false,
14551525
Positional: false,
14561526
},
1527+
{
1528+
Name: "tags.{index}",
1529+
Short: `New tags for the policy (maximum of 10 tags)`,
1530+
Required: false,
1531+
Deprecated: false,
1532+
Positional: false,
1533+
},
14571534
{
14581535
Name: "user-id",
14591536
Short: `New ID of user attributed to the policy`,

0 commit comments

Comments
 (0)