Skip to content

Commit d717641

Browse files
feat(iam): add a delete user command (#2564)
Co-authored-by: Rémy Léone <[email protected]>
1 parent 78812d4 commit d717641

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

internal/namespaces/iam/v1alpha1/iam_cli.go

+36
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func GetGeneratedCommands() *core.Commands {
3535
iamSSHKeyDelete(),
3636
iamUserList(),
3737
iamUserGet(),
38+
iamUserDelete(),
3839
iamApplicationList(),
3940
iamApplicationCreate(),
4041
iamApplicationGet(),
@@ -478,6 +479,41 @@ func iamUserGet() *core.Command {
478479
}
479480
}
480481

482+
func iamUserDelete() *core.Command {
483+
return &core.Command{
484+
Short: `Delete a user`,
485+
Long: `Delete a user.`,
486+
Namespace: "iam",
487+
Resource: "user",
488+
Verb: "delete",
489+
// Deprecated: false,
490+
ArgsType: reflect.TypeOf(iam.DeleteUserRequest{}),
491+
ArgSpecs: core.ArgSpecs{
492+
{
493+
Name: "user-id",
494+
Short: `ID of user to delete`,
495+
Required: true,
496+
Deprecated: false,
497+
Positional: true,
498+
},
499+
},
500+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
501+
request := args.(*iam.DeleteUserRequest)
502+
503+
client := core.ExtractClient(ctx)
504+
api := iam.NewAPI(client)
505+
e = api.DeleteUser(request)
506+
if e != nil {
507+
return nil, e
508+
}
509+
return &core.SuccessResult{
510+
Resource: "user",
511+
Verb: "delete",
512+
}, nil
513+
},
514+
}
515+
}
516+
481517
func iamApplicationList() *core.Command {
482518
return &core.Command{
483519
Short: `List applications of an organization`,

0 commit comments

Comments
 (0)