Skip to content

Commit e96af35

Browse files
authored
feat(iam): add more filtering options for ListAPIKeys (#2773)
1 parent 7e3064f commit e96af35

File tree

5 files changed

+57
-9
lines changed

5 files changed

+57
-9
lines changed

cmd/scw/testdata/test-all-usage-iam-api-key-list-usage.golden

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@ USAGE:
77

88
ARGS:
99
[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)
10-
[application-id] ID of an application bearer
11-
[user-id] ID of a user bearer
1210
[editable] Filter out editable API keys or not
11+
[expirable] Filter out expirable API keys or not
12+
[access-key] Filter out by access key
13+
[description] Filter out by description
14+
[bearer-id] Filter out by bearer ID
15+
[bearer-type] Filter out by type of bearer (unknown_bearer_type | user | application)
1316
organization-id=<retrieved from config> ID of organization
1417

18+
DEPRECATED ARGS:
19+
[application-id] ID of an application bearer
20+
[user-id] ID of a user bearer
21+
1522
FLAGS:
1623
-h, --help help for list
1724

docs/commands/iam.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,14 @@ scw iam api-key list [arg=value ...]
137137
| Name | | Description |
138138
|------|---|-------------|
139139
| order-by | Default: `created_at_asc`<br />One of: `created_at_asc`, `created_at_desc`, `updated_at_asc`, `updated_at_desc`, `expires_at_asc`, `expires_at_desc`, `access_key_asc`, `access_key_desc` | Criteria for sorting results |
140-
| application-id | | ID of an application bearer |
141-
| user-id | | ID of a user bearer |
140+
| ~~application-id~~ | Deprecated | ID of an application bearer |
141+
| ~~user-id~~ | Deprecated | ID of a user bearer |
142142
| editable | | Filter out editable API keys or not |
143+
| expirable | | Filter out expirable API keys or not |
144+
| access-key | | Filter out by access key |
145+
| description | | Filter out by description |
146+
| bearer-id | | Filter out by bearer ID |
147+
| bearer-type | One of: `unknown_bearer_type`, `user`, `application` | Filter out by type of bearer |
143148
| organization-id | Required<br />Default: `<retrieved from config>` | ID of organization |
144149

145150

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/kubernetes-client/go-base v0.0.0-20190205182333-3d0e39759d98
1919
github.com/mattn/go-colorable v0.1.13
2020
github.com/mattn/go-isatty v0.0.17
21-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230207201808-d7c376325ea7
21+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230214124406-206d0c86a6ac
2222
github.com/spf13/cobra v1.6.1
2323
github.com/spf13/pflag v1.0.5
2424
github.com/stretchr/testify v1.8.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw
7070
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
7171
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7272
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
73-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230207201808-d7c376325ea7 h1:9oCbSGqqRkgpLqslbSEMatAY1U+ZLFls4kUQmHn4jJo=
74-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230207201808-d7c376325ea7/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
73+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230214124406-206d0c86a6ac h1:sGWtu+QWecPOfbuOPHE4kVCNqG68mI0CazQaw98p9ew=
74+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230214124406-206d0c86a6ac/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
7575
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
7676
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
7777
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=

internal/namespaces/iam/v1alpha1/iam_cli.go

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,14 +1544,14 @@ func iamAPIKeyList() *core.Command {
15441544
Name: "application-id",
15451545
Short: `ID of an application bearer`,
15461546
Required: false,
1547-
Deprecated: false,
1547+
Deprecated: true,
15481548
Positional: false,
15491549
},
15501550
{
15511551
Name: "user-id",
15521552
Short: `ID of a user bearer`,
15531553
Required: false,
1554-
Deprecated: false,
1554+
Deprecated: true,
15551555
Positional: false,
15561556
},
15571557
{
@@ -1561,6 +1561,42 @@ func iamAPIKeyList() *core.Command {
15611561
Deprecated: false,
15621562
Positional: false,
15631563
},
1564+
{
1565+
Name: "expirable",
1566+
Short: `Filter out expirable API keys or not`,
1567+
Required: false,
1568+
Deprecated: false,
1569+
Positional: false,
1570+
},
1571+
{
1572+
Name: "access-key",
1573+
Short: `Filter out by access key`,
1574+
Required: false,
1575+
Deprecated: false,
1576+
Positional: false,
1577+
},
1578+
{
1579+
Name: "description",
1580+
Short: `Filter out by description`,
1581+
Required: false,
1582+
Deprecated: false,
1583+
Positional: false,
1584+
},
1585+
{
1586+
Name: "bearer-id",
1587+
Short: `Filter out by bearer ID`,
1588+
Required: false,
1589+
Deprecated: false,
1590+
Positional: false,
1591+
},
1592+
{
1593+
Name: "bearer-type",
1594+
Short: `Filter out by type of bearer`,
1595+
Required: false,
1596+
Deprecated: false,
1597+
Positional: false,
1598+
EnumValues: []string{"unknown_bearer_type", "user", "application"},
1599+
},
15641600
{
15651601
Name: "organization-id",
15661602
Short: `ID of organization`,

0 commit comments

Comments
 (0)