Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iam): add support for adding members #4108

Merged
merged 1 commit into from
Sep 9, 2024
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
10 changes: 7 additions & 3 deletions cmd/scw/testdata/test-all-usage-iam-user-create-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ USAGE:
scw iam user create [arg=value ...]

ARGS:
email Email of the user
[tags.{index}] Tags associated with the user
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
[email] Email of the user
[tags.{index}] Tags associated with the user
[member.email] Email of the user to create
[member.send-password-email] Whether or not to send an email containing the member's password.
[member.username] The member's username
[member.password] The member's password
[organization-id] Organization ID to use. If none is passed the default organization ID will be used

FLAGS:
-h, --help help for create
Expand Down
6 changes: 5 additions & 1 deletion docs/commands/iam.md
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,12 @@ scw iam user create [arg=value ...]

| Name | | Description |
|------|---|-------------|
| email | Required | Email of the user |
| email | | Email of the user |
| tags.{index} | | Tags associated with the user |
| member.email | | Email of the user to create |
| member.send-password-email | | Whether or not to send an email containing the member's password. |
| member.username | | The member's username |
| member.password | | The member's password |
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |


Expand Down
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
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240909084652-00d3fbf2d825
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 @@ -465,8 +465,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 h1:yoKAVkEVwAqbGbR8n87rHQ1dulL25rKloGadb3vm770=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30/go.mod h1:sH0u6fq6x4R5M7WxkoQFY/o7UaiItec0o1LinLCJNq8=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240909084652-00d3fbf2d825 h1:bkMLD6c7sSsDlyHlCbRMStabJevV4wDGn0dHhHB7OBM=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240909084652-00d3fbf2d825/go.mod h1:o/2twhmcz4HlhtuuubCuwQ/fe+zyzoJR85+02gy04yY=
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
32 changes: 30 additions & 2 deletions internal/namespaces/iam/v1alpha1/iam_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"reflect"

"github.com/scaleway/scaleway-cli/v2/core"
iam "github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1"
"github.com/scaleway/scaleway-sdk-go/api/iam/v1alpha1"
"github.com/scaleway/scaleway-sdk-go/scw"
)

Expand Down Expand Up @@ -609,7 +609,7 @@ func iamUserCreate() *core.Command {
{
Name: "email",
Short: `Email of the user`,
Required: true,
Required: false,
Deprecated: false,
Positional: false,
},
Expand All @@ -620,6 +620,34 @@ func iamUserCreate() *core.Command {
Deprecated: false,
Positional: false,
},
{
Name: "member.email",
Short: `Email of the user to create`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "member.send-password-email",
Short: `Whether or not to send an email containing the member's password.`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "member.username",
Short: `The member's username`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "member.password",
Short: `The member's password`,
Required: false,
Deprecated: false,
Positional: false,
},
core.OrganizationIDArgSpec(),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
Expand Down
Loading