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 examples and see-alsos #2475

Merged
merged 1 commit into from
Aug 25, 2022
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/kubernetes-client/go-base v0.0.0-20190205182333-3d0e39759d98
github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty v0.0.16
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220824154746-aa9860649253
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220825105521-d3f8784dcb8b
github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220824154746-aa9860649253 h1:OlRfUqKcB4XsahOXTnI4k4RTkrzJastpAAMmXNAkPUc=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220824154746-aa9860649253/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220825105521-d3f8784dcb8b h1:HW6dHxcnYIcRD6ezTnVoFc05usBgDTsd4bCiWKcumYI=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9.0.20220825105521-d3f8784dcb8b/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
Expand Down
34 changes: 30 additions & 4 deletions internal/namespaces/iam/v1alpha1/iam_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ func iamSSHKeyList() *core.Command {
FieldName: "CreatedAt",
},
{
FieldName: "ProjectID",
FieldName: "Fingerprint",
},
{
FieldName: "CreationIP",
FieldName: "ProjectID",
},
{
FieldName: "Disabled",
Expand Down Expand Up @@ -805,15 +805,25 @@ func iamGroupCreate() *core.Command {
return api.CreateGroup(request)

},
Examples: []*core.Example{
{
Short: "Create a group",
Raw: `scw iam group create name=foobar`,
},
},
SeeAlsos: []*core.SeeAlso{
{
Command: "scw iam group list",
Short: "List all groups",
Command: "scw iam group add-member",
Short: "Add a group member",
},
{
Command: "scw iam group delete",
Short: "Delete a group",
},
{
Command: "scw iam policy create",
Short: "Create a policy for a group",
},
},
}
}
Expand Down Expand Up @@ -973,6 +983,16 @@ func iamGroupRemoveMember() *core.Command {
return api.RemoveGroupMember(request)

},
SeeAlsos: []*core.SeeAlso{
{
Command: "scw iam group remove-member",
Short: "Remove a group member",
},
{
Command: "scw iam group create",
Short: "Create a group",
},
},
}
}

Expand Down Expand Up @@ -1195,6 +1215,12 @@ func iamPolicyCreate() *core.Command {
return api.CreatePolicy(request)

},
Examples: []*core.Example{
{
Short: "Add a policy for a group that gives InstanceFullAccess on all projects",
Raw: `scw iam policy create group-id=11111111-1111-1111-1111-111111111111 rules.0.organization-id=11111111-1111-1111-1111-111111111111 rules.0.permission-set-names.0=InstanceFullAccess`,
},
},
}
}

Expand Down