Skip to content

Commit 7e6e28a

Browse files
authored
docs(iam): document UpdateUserUsername (scaleway#4359)
1 parent 85c83a2 commit 7e6e28a

File tree

6 files changed

+81
-3
lines changed

6 files changed

+81
-3
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Update an user's username. Private Beta feature.
4+
5+
USAGE:
6+
scw iam user update-username <user-id ...> [arg=value ...]
7+
8+
ARGS:
9+
user-id ID of the user to update
10+
username The new username
11+
12+
FLAGS:
13+
-h, --help help for update-username
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ AVAILABLE COMMANDS:
1212
list List users of an Organization
1313
update Update a user
1414
update-password Update an user's password. Private Beta feature.
15+
update-username Update an user's username. Private Beta feature.
1516

1617
FLAGS:
1718
-h, --help help for user

docs/commands/iam.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ This API allows you to manage Identity and Access Management (IAM) across your S
5959
- [List users of an Organization](#list-users-of-an-organization)
6060
- [Update a user](#update-a-user)
6161
- [Update an user's password. Private Beta feature.](#update-an-user's-password.-private-beta-feature.)
62+
- [Update an user's username. Private Beta feature.](#update-an-user's-username.-private-beta-feature.)
6263

6364

6465
## API keys management commands
@@ -1171,3 +1172,23 @@ scw iam user update-password <user-id ...> [arg=value ...]
11711172

11721173

11731174

1175+
### Update an user's username. Private Beta feature.
1176+
1177+
Update an user's username. Private Beta feature.
1178+
1179+
**Usage:**
1180+
1181+
```
1182+
scw iam user update-username <user-id ...> [arg=value ...]
1183+
```
1184+
1185+
1186+
**Args:**
1187+
1188+
| Name | | Description |
1189+
|------|---|-------------|
1190+
| user-id | Required | ID of the user to update |
1191+
| username | Required | The new username |
1192+
1193+
1194+

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/mattn/go-isatty v0.0.20
2727
github.com/moby/buildkit v0.13.2
2828
github.com/opencontainers/go-digest v1.0.0
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241209153125-92afa47368ef
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241212151423-0d220e058bfc
3030
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3131
github.com/spf13/cobra v1.8.1
3232
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
466466
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
467467
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
468468
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
469-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241209153125-92afa47368ef h1:WlyvzZzG1ipVvmolk69a7VdWCP5J0nCRxsNGpUspGrc=
470-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241209153125-92afa47368ef/go.mod h1:kzh+BSAvpoyHHdHBCDhmSWtBc1NbLMZ2lWHqnBoxFks=
469+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241212151423-0d220e058bfc h1:TxTKg5QuwgdKZ3+i1xPgihahVMGoO4zlqkC6zh9aHp4=
470+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241212151423-0d220e058bfc/go.mod h1:kzh+BSAvpoyHHdHBCDhmSWtBc1NbLMZ2lWHqnBoxFks=
471471
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
472472
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
473473
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

internal/namespaces/iam/v1alpha1/iam_cli.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func GetGeneratedCommands() *core.Commands {
4040
iamUserUpdate(),
4141
iamUserDelete(),
4242
iamUserCreate(),
43+
iamUserUpdateUsername(),
4344
iamUserUpdatePassword(),
4445
iamApplicationList(),
4546
iamApplicationCreate(),
@@ -676,6 +677,42 @@ func iamUserCreate() *core.Command {
676677
}
677678
}
678679

680+
func iamUserUpdateUsername() *core.Command {
681+
return &core.Command{
682+
Short: `Update an user's username. Private Beta feature.`,
683+
Long: `Update an user's username. Private Beta feature.`,
684+
Namespace: "iam",
685+
Resource: "user",
686+
Verb: "update-username",
687+
// Deprecated: false,
688+
ArgsType: reflect.TypeOf(iam.UpdateUserUsernameRequest{}),
689+
ArgSpecs: core.ArgSpecs{
690+
{
691+
Name: "user-id",
692+
Short: `ID of the user to update`,
693+
Required: true,
694+
Deprecated: false,
695+
Positional: true,
696+
},
697+
{
698+
Name: "username",
699+
Short: `The new username`,
700+
Required: true,
701+
Deprecated: false,
702+
Positional: false,
703+
},
704+
},
705+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
706+
request := args.(*iam.UpdateUserUsernameRequest)
707+
708+
client := core.ExtractClient(ctx)
709+
api := iam.NewAPI(client)
710+
return api.UpdateUserUsername(request)
711+
712+
},
713+
}
714+
}
715+
679716
func iamUserUpdatePassword() *core.Command {
680717
return &core.Command{
681718
Short: `Update an user's password. Private Beta feature.`,

0 commit comments

Comments
 (0)