Skip to content

Commit

Permalink
feat(iam): add doc for UpdateUserPassword (#4250)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Oct 31, 2024
1 parent 81af366 commit f7ac720
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update an user's password.

USAGE:
scw iam user update-password <user-id ...> [arg=value ...]

ARGS:
user-id ID of the user to update
password The new password
[send-email] Whether or not to send an email alerting the user their password has changed

FLAGS:
-h, --help help for update-password

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
11 changes: 6 additions & 5 deletions cmd/scw/testdata/test-all-usage-iam-user-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ USAGE:
scw iam user <command>

AVAILABLE COMMANDS:
create Create a new user
delete Delete a guest user from an Organization
get Get a given user
list List users of an Organization
update Update a user
create Create a new user
delete Delete a guest user from an Organization
get Get a given user
list List users of an Organization
update Update a user
update-password Update an user's password

FLAGS:
-h, --help help for user
Expand Down
22 changes: 22 additions & 0 deletions docs/commands/iam.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ This API allows you to manage Identity and Access Management (IAM) across your S
- [Get a given user](#get-a-given-user)
- [List users of an Organization](#list-users-of-an-organization)
- [Update a user](#update-a-user)
- [Update an user's password](#update-an-user's-password)


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



### Update an user's password

Update an user's password.

**Usage:**

```
scw iam user update-password <user-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| user-id | Required | ID of the user to update |
| password | Required | The new password |
| send-email | | Whether or not to send an email alerting the user their password has changed |



44 changes: 44 additions & 0 deletions internal/namespaces/iam/v1alpha1/iam_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func GetGeneratedCommands() *core.Commands {
iamUserUpdate(),
iamUserDelete(),
iamUserCreate(),
iamUserUpdatePassword(),
iamApplicationList(),
iamApplicationCreate(),
iamApplicationGet(),
Expand Down Expand Up @@ -661,6 +662,49 @@ func iamUserCreate() *core.Command {
}
}

func iamUserUpdatePassword() *core.Command {
return &core.Command{
Short: `Update an user's password`,
Long: `Update an user's password.`,
Namespace: "iam",
Resource: "user",
Verb: "update-password",
// Deprecated: false,
ArgsType: reflect.TypeOf(iam.UpdateUserPasswordRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "user-id",
Short: `ID of the user to update`,
Required: true,
Deprecated: false,
Positional: true,
},
{
Name: "password",
Short: `The new password`,
Required: true,
Deprecated: false,
Positional: false,
},
{
Name: "send-email",
Short: `Whether or not to send an email alerting the user their password has changed`,
Required: false,
Deprecated: false,
Positional: false,
},
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*iam.UpdateUserPasswordRequest)

client := core.ExtractClient(ctx)
api := iam.NewAPI(client)
return api.UpdateUserPassword(request)

},
}
}

func iamApplicationList() *core.Command {
return &core.Command{
Short: `List applications of an Organization`,
Expand Down

0 comments on commit f7ac720

Please sign in to comment.