Skip to content

Commit f7ac720

Browse files
authored
feat(iam): add doc for UpdateUserPassword (#4250)
1 parent 81af366 commit f7ac720

File tree

4 files changed

+92
-5
lines changed

4 files changed

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

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ USAGE:
66
scw iam user <command>
77

88
AVAILABLE COMMANDS:
9-
create Create a new user
10-
delete Delete a guest user from an Organization
11-
get Get a given user
12-
list List users of an Organization
13-
update Update a user
9+
create Create a new user
10+
delete Delete a guest user from an Organization
11+
get Get a given user
12+
list List users of an Organization
13+
update Update a user
14+
update-password Update an user's password
1415

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

docs/commands/iam.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ This API allows you to manage Identity and Access Management (IAM) across your S
5858
- [Get a given user](#get-a-given-user)
5959
- [List users of an Organization](#list-users-of-an-organization)
6060
- [Update a user](#update-a-user)
61+
- [Update an user's password](#update-an-user's-password)
6162

6263

6364
## API keys management commands
@@ -1147,3 +1148,24 @@ scw iam user update <user-id ...> [arg=value ...]
11471148

11481149

11491150

1151+
### Update an user's password
1152+
1153+
Update an user's password.
1154+
1155+
**Usage:**
1156+
1157+
```
1158+
scw iam user update-password <user-id ...> [arg=value ...]
1159+
```
1160+
1161+
1162+
**Args:**
1163+
1164+
| Name | | Description |
1165+
|------|---|-------------|
1166+
| user-id | Required | ID of the user to update |
1167+
| password | Required | The new password |
1168+
| send-email | | Whether or not to send an email alerting the user their password has changed |
1169+
1170+
1171+

internal/namespaces/iam/v1alpha1/iam_cli.go

Lines changed: 44 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+
iamUserUpdatePassword(),
4344
iamApplicationList(),
4445
iamApplicationCreate(),
4546
iamApplicationGet(),
@@ -661,6 +662,49 @@ func iamUserCreate() *core.Command {
661662
}
662663
}
663664

665+
func iamUserUpdatePassword() *core.Command {
666+
return &core.Command{
667+
Short: `Update an user's password`,
668+
Long: `Update an user's password.`,
669+
Namespace: "iam",
670+
Resource: "user",
671+
Verb: "update-password",
672+
// Deprecated: false,
673+
ArgsType: reflect.TypeOf(iam.UpdateUserPasswordRequest{}),
674+
ArgSpecs: core.ArgSpecs{
675+
{
676+
Name: "user-id",
677+
Short: `ID of the user to update`,
678+
Required: true,
679+
Deprecated: false,
680+
Positional: true,
681+
},
682+
{
683+
Name: "password",
684+
Short: `The new password`,
685+
Required: true,
686+
Deprecated: false,
687+
Positional: false,
688+
},
689+
{
690+
Name: "send-email",
691+
Short: `Whether or not to send an email alerting the user their password has changed`,
692+
Required: false,
693+
Deprecated: false,
694+
Positional: false,
695+
},
696+
},
697+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
698+
request := args.(*iam.UpdateUserPasswordRequest)
699+
700+
client := core.ExtractClient(ctx)
701+
api := iam.NewAPI(client)
702+
return api.UpdateUserPassword(request)
703+
704+
},
705+
}
706+
}
707+
664708
func iamApplicationList() *core.Command {
665709
return &core.Command{
666710
Short: `List applications of an Organization`,

0 commit comments

Comments
 (0)