Skip to content

Commit

Permalink
feat(iam): add filtering on multiple IDs on listing endpoints (#3586)
Browse files Browse the repository at this point in the history
Co-authored-by: Leïla MARABESE <[email protected]>
  • Loading branch information
scaleway-bot and Mia-Cross authored Jan 10, 2024
1 parent a7073d0 commit 4a81628
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ ARGS:
[order-by=created_at_asc] Criteria for sorting results (created_at_asc | created_at_desc | updated_at_asc | updated_at_desc | expires_at_asc | expires_at_desc | access_key_asc | access_key_desc)
[editable] Defines whether to filter out editable API keys or not
[expired] Defines whether to filter out expired API keys or not
[access-key] Filter by access key
[description] Filter by description
[bearer-id] Filter by bearer ID
[bearer-type] Filter by type of bearer (unknown_bearer_type | user | application)
[access-keys.{index}] Filter by a list of access keys
organization-id=<retrieved from config> ID of Organization

DEPRECATED ARGS:
[application-id] ID of application that bears the API key
[user-id] ID of user that bears the API key
[access-key] Filter by access key (deprecated in favor of `access_keys`)

FLAGS:
-h, --help help for list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ARGS:
[no-principal] Defines whether or not the policy is attributed to a principal
[policy-name] Name of the policy to fetch
[tag] Filter by tags containing a given string
[policy-ids.{index}] Filter by a list of IDs
[organization-id=<retrieved from config>] Organization ID to use. If none is passed the default organization ID will be used

FLAGS:
Expand Down
4 changes: 3 additions & 1 deletion docs/commands/iam.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ scw iam api-key list [arg=value ...]
| ~~user-id~~ | Deprecated | ID of user that bears the API key |
| editable | | Defines whether to filter out editable API keys or not |
| expired | | Defines whether to filter out expired API keys or not |
| access-key | | Filter by access key |
| ~~access-key~~ | Deprecated | Filter by access key (deprecated in favor of `access_keys`) |
| description | | Filter by description |
| bearer-id | | Filter by bearer ID |
| bearer-type | One of: `unknown_bearer_type`, `user`, `application` | Filter by type of bearer |
| access-keys.{index} | | Filter by a list of access keys |
| organization-id | Required<br />Default: `<retrieved from config>` | ID of Organization |


Expand Down Expand Up @@ -772,6 +773,7 @@ scw iam policy list [arg=value ...]
| no-principal | | Defines whether or not the policy is attributed to a principal |
| policy-name | | Name of the policy to fetch |
| tag | | Filter by tags containing a given string |
| policy-ids.{index} | | Filter by a list of IDs |
| organization-id | Default: `<retrieved from config>` | 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 @@ -24,7 +24,7 @@ require (
github.com/moby/buildkit v0.11.6
github.com/opencontainers/go-digest v1.0.0
github.com/pkg/errors v0.9.1
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.22.0.20240104151524-ab214475a5a5
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.22.0.20240109155607-70eec6dc9637
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.8.0
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 @@ -387,8 +387,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN
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.22.0.20240104151524-ab214475a5a5 h1:qoQSzki+34iQa2YStpWCI7qHRRRCxkR7OxaysQCchcI=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.22.0.20240104151524-ab214475a5a5/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.22.0.20240109155607-70eec6dc9637 h1:F/EUOngL9fqQsi3JHn8S6n8oJasOCFk5J/76D+n3s2g=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.22.0.20240109155607-70eec6dc9637/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
Expand Down
18 changes: 16 additions & 2 deletions internal/namespaces/iam/v1alpha1/iam_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,13 @@ func iamPolicyList() *core.Command {
Deprecated: false,
Positional: false,
},
{
Name: "policy-ids.{index}",
Short: `Filter by a list of IDs`,
Required: false,
Deprecated: false,
Positional: false,
},
core.OrganizationIDArgSpec(),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
Expand Down Expand Up @@ -1853,9 +1860,9 @@ func iamAPIKeyList() *core.Command {
},
{
Name: "access-key",
Short: `Filter by access key`,
Short: `Filter by access key (deprecated in favor of ` + "`" + `access_keys` + "`" + `)`,
Required: false,
Deprecated: false,
Deprecated: true,
Positional: false,
},
{
Expand All @@ -1880,6 +1887,13 @@ func iamAPIKeyList() *core.Command {
Positional: false,
EnumValues: []string{"unknown_bearer_type", "user", "application"},
},
{
Name: "access-keys.{index}",
Short: `Filter by a list of access keys`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "organization-id",
Short: `ID of Organization`,
Expand Down

0 comments on commit 4a81628

Please sign in to comment.