Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update an user's username. Private Beta feature.

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

ARGS:
user-id ID of the user to update
username The new username

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

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
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-all-usage-iam-user-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ AVAILABLE COMMANDS:
list List users of an Organization
update Update a user
update-password Update an user's password. Private Beta feature.
update-username Update an user's username. Private Beta feature.

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


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



### Update an user's username. Private Beta feature.

Update an user's username. Private Beta feature.

**Usage:**

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


**Args:**

| Name | | Description |
|------|---|-------------|
| user-id | Required | ID of the user to update |
| username | Required | The new username |



2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/moby/buildkit v0.13.2
github.com/opencontainers/go-digest v1.0.0
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241209153125-92afa47368ef
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241212151423-0d220e058bfc
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241209153125-92afa47368ef h1:WlyvzZzG1ipVvmolk69a7VdWCP5J0nCRxsNGpUspGrc=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241209153125-92afa47368ef/go.mod h1:kzh+BSAvpoyHHdHBCDhmSWtBc1NbLMZ2lWHqnBoxFks=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241212151423-0d220e058bfc h1:TxTKg5QuwgdKZ3+i1xPgihahVMGoO4zlqkC6zh9aHp4=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241212151423-0d220e058bfc/go.mod h1:kzh+BSAvpoyHHdHBCDhmSWtBc1NbLMZ2lWHqnBoxFks=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=
Expand Down
37 changes: 37 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(),
iamUserUpdateUsername(),
iamUserUpdatePassword(),
iamApplicationList(),
iamApplicationCreate(),
Expand Down Expand Up @@ -676,6 +677,42 @@ func iamUserCreate() *core.Command {
}
}

func iamUserUpdateUsername() *core.Command {
return &core.Command{
Short: `Update an user's username. Private Beta feature.`,
Long: `Update an user's username. Private Beta feature.`,
Namespace: "iam",
Resource: "user",
Verb: "update-username",
// Deprecated: false,
ArgsType: reflect.TypeOf(iam.UpdateUserUsernameRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "user-id",
Short: `ID of the user to update`,
Required: true,
Deprecated: false,
Positional: true,
},
{
Name: "username",
Short: `The new username`,
Required: true,
Deprecated: false,
Positional: false,
},
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*iam.UpdateUserUsernameRequest)

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

},
}
}

func iamUserUpdatePassword() *core.Command {
return &core.Command{
Short: `Update an user's password. Private Beta feature.`,
Expand Down
Loading