Skip to content

Commit 95f1c19

Browse files
docs(iam): specify fields limits (#2394)
Co-authored-by: Rémy Léone <[email protected]>
1 parent 42d52b3 commit 95f1c19

File tree

3 files changed

+19
-85
lines changed

3 files changed

+19
-85
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/kubernetes-client/go-base v0.0.0-20190205182333-3d0e39759d98
1818
github.com/mattn/go-colorable v0.1.12
1919
github.com/mattn/go-isatty v0.0.14
20-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220630163426-8dc9d2b95d0b
20+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220701084505-e4e065be0a37
2121
github.com/spf13/cobra v1.5.0
2222
github.com/spf13/pflag v1.0.5
2323
github.com/stretchr/testify v1.8.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
5757
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
5858
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5959
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
60-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220630163426-8dc9d2b95d0b h1:z0q2TsHNDT/2TKjlUpGsvZ3JVqclONKeHKho432UVy8=
61-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220630163426-8dc9d2b95d0b/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
60+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220701084505-e4e065be0a37 h1:lQW8Ia49Y8GKjnLFrCci7zcZjbkHm5+flcyTAzdw+YA=
61+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220701084505-e4e065be0a37/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
6262
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
6363
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
6464
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=

internal/namespaces/iam/v1alpha1/iam_cli.go

+16-82
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ func GetGeneratedCommands() *core.Commands {
3535
iamSSHKeyRemove(),
3636
iamUsersList(),
3737
iamUsersGet(),
38-
iamUsersUpdate(),
39-
iamUsersRemove(),
4038
iamApplicationsList(),
4139
iamApplicationsAdd(),
4240
iamApplicationsGet(),
@@ -248,14 +246,14 @@ func iamSSHKeyAdd() *core.Command {
248246
ArgSpecs: core.ArgSpecs{
249247
{
250248
Name: "name",
251-
Short: `The name of the SSH key`,
249+
Short: `The name of the SSH key. Max length is 1000`,
252250
Required: false,
253251
Deprecated: false,
254252
Positional: false,
255253
},
256254
{
257255
Name: "public-key",
258-
Short: `SSH public key. Currently ssh-rsa, ssh-dss (DSA), ssh-ed25519 and ecdsa keys with NIST curves are supported`,
256+
Short: `SSH public key. Currently ssh-rsa, ssh-dss (DSA), ssh-ed25519 and ecdsa keys with NIST curves are supported. Max length is 65000`,
259257
Required: true,
260258
Deprecated: false,
261259
Positional: false,
@@ -336,7 +334,7 @@ func iamSSHKeyUpdate() *core.Command {
336334
},
337335
{
338336
Name: "name",
339-
Short: `Name of the SSH key`,
337+
Short: `Name of the SSH key. Max length is 1000`,
340338
Required: false,
341339
Deprecated: false,
342340
Positional: false,
@@ -477,70 +475,6 @@ func iamUsersGet() *core.Command {
477475
}
478476
}
479477

480-
func iamUsersUpdate() *core.Command {
481-
return &core.Command{
482-
Short: `Update an existing user`,
483-
Long: `Update an existing user.`,
484-
Namespace: "iam",
485-
Resource: "users",
486-
Verb: "update",
487-
// Deprecated: false,
488-
ArgsType: reflect.TypeOf(iam.UpdateUserRequest{}),
489-
ArgSpecs: core.ArgSpecs{
490-
{
491-
Name: "user-id",
492-
Short: `ID of user to update`,
493-
Required: true,
494-
Deprecated: false,
495-
Positional: false,
496-
},
497-
},
498-
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
499-
request := args.(*iam.UpdateUserRequest)
500-
501-
client := core.ExtractClient(ctx)
502-
api := iam.NewAPI(client)
503-
return api.UpdateUser(request)
504-
505-
},
506-
}
507-
}
508-
509-
func iamUsersRemove() *core.Command {
510-
return &core.Command{
511-
Short: `Remove a user`,
512-
Long: `Remove a user.`,
513-
Namespace: "iam",
514-
Resource: "users",
515-
Verb: "remove",
516-
// Deprecated: false,
517-
ArgsType: reflect.TypeOf(iam.DeleteUserRequest{}),
518-
ArgSpecs: core.ArgSpecs{
519-
{
520-
Name: "user-id",
521-
Short: `ID of user to delete`,
522-
Required: true,
523-
Deprecated: false,
524-
Positional: false,
525-
},
526-
},
527-
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
528-
request := args.(*iam.DeleteUserRequest)
529-
530-
client := core.ExtractClient(ctx)
531-
api := iam.NewAPI(client)
532-
e = api.DeleteUser(request)
533-
if e != nil {
534-
return nil, e
535-
}
536-
return &core.SuccessResult{
537-
Resource: "users",
538-
Verb: "remove",
539-
}, nil
540-
},
541-
}
542-
}
543-
544478
func iamApplicationsList() *core.Command {
545479
return &core.Command{
546480
Short: `List applications of an organization`,
@@ -615,14 +549,14 @@ func iamApplicationsAdd() *core.Command {
615549
ArgSpecs: core.ArgSpecs{
616550
{
617551
Name: "name",
618-
Short: `Name of application to create`,
552+
Short: `Name of application to create (max length is 64 chars)`,
619553
Required: false,
620554
Deprecated: false,
621555
Positional: false,
622556
},
623557
{
624558
Name: "description",
625-
Short: `Description of application`,
559+
Short: `Description of application (max length is 200 chars)`,
626560
Required: false,
627561
Deprecated: false,
628562
Positional: false,
@@ -688,14 +622,14 @@ func iamApplicationsUpdate() *core.Command {
688622
},
689623
{
690624
Name: "name",
691-
Short: `New name of application`,
625+
Short: `New name of application (max length is 64 chars)`,
692626
Required: false,
693627
Deprecated: false,
694628
Positional: false,
695629
},
696630
{
697631
Name: "description",
698-
Short: `New description of application`,
632+
Short: `New description of application (max length is 200 chars)`,
699633
Required: false,
700634
Deprecated: false,
701635
Positional: false,
@@ -828,14 +762,14 @@ func iamGroupAdd() *core.Command {
828762
ArgSpecs: core.ArgSpecs{
829763
{
830764
Name: "name",
831-
Short: `Name of the group to create. MUST be unique inside an organization`,
765+
Short: `Name of the group to create (max length is 64 chars). MUST be unique inside an organization`,
832766
Required: false,
833767
Deprecated: false,
834768
Positional: false,
835769
},
836770
{
837771
Name: "description",
838-
Short: `Description of the group to create`,
772+
Short: `Description of the group to create (max length is 200 chars)`,
839773
Required: false,
840774
Deprecated: false,
841775
Positional: false,
@@ -911,14 +845,14 @@ func iamGroupUpdate() *core.Command {
911845
},
912846
{
913847
Name: "name",
914-
Short: `New name for the group. MUST be unique inside an organization`,
848+
Short: `New name for the group (max length is 64 chars). MUST be unique inside an organization`,
915849
Required: false,
916850
Deprecated: false,
917851
Positional: false,
918852
},
919853
{
920854
Name: "description",
921-
Short: `New description for the group`,
855+
Short: `New description for the group (max length is 200 chars)`,
922856
Required: false,
923857
Deprecated: false,
924858
Positional: false,
@@ -1071,14 +1005,14 @@ func iamPoliciesAdd() *core.Command {
10711005
ArgSpecs: core.ArgSpecs{
10721006
{
10731007
Name: "name",
1074-
Short: `Name of policy to create`,
1008+
Short: `Name of policy to create (max length is 64 chars)`,
10751009
Required: false,
10761010
Deprecated: false,
10771011
Positional: false,
10781012
},
10791013
{
10801014
Name: "description",
1081-
Short: `Description of policy to create`,
1015+
Short: `Description of policy to create (max length is 200 chars)`,
10821016
Required: false,
10831017
Deprecated: false,
10841018
Positional: false,
@@ -1193,14 +1127,14 @@ func iamPoliciesUpdate() *core.Command {
11931127
},
11941128
{
11951129
Name: "name",
1196-
Short: `New name of policy`,
1130+
Short: `New name of policy (max length is 64 chars)`,
11971131
Required: false,
11981132
Deprecated: false,
11991133
Positional: false,
12001134
},
12011135
{
12021136
Name: "description",
1203-
Short: `New description of policy`,
1137+
Short: `New description of policy (max length is 200 chars)`,
12041138
Required: false,
12051139
Deprecated: false,
12061140
Positional: false,
@@ -1500,7 +1434,7 @@ func iamAPIKeyAdd() *core.Command {
15001434
},
15011435
{
15021436
Name: "description",
1503-
Short: `The description of the API key`,
1437+
Short: `The description of the API key (max length is 200 chars)`,
15041438
Required: false,
15051439
Deprecated: false,
15061440
Positional: false,

0 commit comments

Comments
 (0)