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
18 changes: 18 additions & 0 deletions cmd/scw/testdata/test-all-usage-iam-user-lock-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Lock a member. A locked member cannot log in or use API keys until the locked status is removed.

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

ARGS:
user-id ID of the user to lock

FLAGS:
-h, --help help for lock

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
18 changes: 18 additions & 0 deletions cmd/scw/testdata/test-all-usage-iam-user-unlock-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Unlock a member.

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

ARGS:
user-id ID of the user to unlock

FLAGS:
-h, --help help for unlock

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
2 changes: 2 additions & 0 deletions cmd/scw/testdata/test-all-usage-iam-user-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ AVAILABLE COMMANDS:
delete Delete a guest user from an Organization
get Get a given user
list List users of an Organization
lock Lock a member
unlock Unlock a member
update Update a user
update-password Update an user's password.
update-username Update an user's username.
Expand Down
40 changes: 40 additions & 0 deletions docs/commands/iam.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ This API allows you to manage Identity and Access Management (IAM) across your S
- [Delete a guest user from an Organization](#delete-a-guest-user-from-an-organization)
- [Get a given user](#get-a-given-user)
- [List users of an Organization](#list-users-of-an-organization)
- [Lock a member](#lock-a-member)
- [Unlock a member](#unlock-a-member)
- [Update a user](#update-a-user)
- [Update an user's password.](#update-an-user's-password.)
- [Update an user's username.](#update-an-user's-username.)
Expand Down Expand Up @@ -1299,6 +1301,44 @@ scw iam user list [arg=value ...]



### Lock a member

Lock a member. A locked member cannot log in or use API keys until the locked status is removed.

**Usage:**

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


**Args:**

| Name | | Description |
|------|---|-------------|
| user-id | Required | ID of the user to lock |



### Unlock a member

Unlock a member.

**Usage:**

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


**Args:**

| Name | | Description |
|------|---|-------------|
| user-id | Required | ID of the user to unlock |



### Update a user

Update the parameters of a user, including `tags`.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/moby/buildkit v0.26.2
github.com/opencontainers/go-digest v1.0.0
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251126083441-c306e91d6b43
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251126163841-f8e137ded5a4
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.10.1
github.com/spf13/pflag v1.0.10
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
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.35.0.20251126083441-c306e91d6b43 h1:MXwUsRKtGFvYZxVJz2Z8A+9l81Ag4TKoL6LpMLrNc+I=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251126083441-c306e91d6b43/go.mod h1:h/elW4JdNo225GP5FZHJ/RPyCNz79lxaeub3PyGzE9o=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251126163841-f8e137ded5a4 h1:6/n7fmgdMmeWXcnXdIMWhfvNQWg7EFpzP/roBAPItR4=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35.0.20251126163841-f8e137ded5a4/go.mod h1:h/elW4JdNo225GP5FZHJ/RPyCNz79lxaeub3PyGzE9o=
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.9.1 h1:nZZaNz4DiERIQguNy0cL5qTdn9lR8XKHf4RUyG1Sx3g=
Expand Down
60 changes: 60 additions & 0 deletions internal/namespaces/iam/v1alpha1/iam_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ func GetGeneratedCommands() *core.Commands {
iamUserCreate(),
iamUserUpdateUsername(),
iamUserUpdatePassword(),
iamUserLock(),
iamUserUnlock(),
iamApplicationList(),
iamApplicationCreate(),
iamApplicationGet(),
Expand Down Expand Up @@ -875,6 +877,64 @@ func iamUserUpdatePassword() *core.Command {
}
}

func iamUserLock() *core.Command {
return &core.Command{
Short: `Lock a member`,
Long: `Lock a member. A locked member cannot log in or use API keys until the locked status is removed.`,
Namespace: "iam",
Resource: "user",
Verb: "lock",
// Deprecated: false,
ArgsType: reflect.TypeOf(iam.LockUserRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "user-id",
Short: `ID of the user to lock`,
Required: true,
Deprecated: false,
Positional: true,
},
},
Run: func(ctx context.Context, args any) (i any, e error) {
request := args.(*iam.LockUserRequest)

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

return api.LockUser(request)
},
}
}

func iamUserUnlock() *core.Command {
return &core.Command{
Short: `Unlock a member`,
Long: `Unlock a member.`,
Namespace: "iam",
Resource: "user",
Verb: "unlock",
// Deprecated: false,
ArgsType: reflect.TypeOf(iam.UnlockUserRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "user-id",
Short: `ID of the user to unlock`,
Required: true,
Deprecated: false,
Positional: true,
},
},
Run: func(ctx context.Context, args any) (i any, e error) {
request := args.(*iam.UnlockUserRequest)

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

return api.UnlockUser(request)
},
}
}

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