Skip to content

Commit 5483764

Browse files
scaleway-botyfodil
andauthored
feat(product_catalog): add filter by API ID in the catalog API (#5459)
Co-authored-by: Yacine Fodil <105779815+yfodil@users.noreply.github.com>
1 parent 2790729 commit 5483764

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

cmd/scw/testdata/test-all-usage-product-catalog-product-list-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ARGS:
1212
[zone] Filter products by zone.
1313
[datacenter] Filter products by datacenter.
1414
[status.{index}] The lists of filtered product status, if empty only products with status public_beta, general_availability, preview, end_of_new_features, end_of_growth, end_of_deployment, end_of_support, end_of_sale, end_of_life or retired will be returned. (unknown_status | public_beta | preview | general_availability | end_of_new_features | end_of_growth | end_of_deployment | end_of_support | end_of_sale | end_of_life | retired)
15+
[api-ids.{index}] Filter products by API IDs. Each ID is matched against product-specific identifiers: `dedibox.offer_id` (converted to string), `elastic_metal.offer_id`, `apple_silicon.server_type`, `instance.offer_id`, and `load_balancer.node.offer_id`. Products that do not support API ID filtering are excluded from the results. If empty, no filtering is applied.
1516

1617
FLAGS:
1718
-h, --help help for list

docs/commands/product-catalog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ scw product-catalog product list [arg=value ...]
3434
| zone | | Filter products by zone. |
3535
| datacenter | | Filter products by datacenter. |
3636
| status.{index} | One of: `unknown_status`, `public_beta`, `preview`, `general_availability`, `end_of_new_features`, `end_of_growth`, `end_of_deployment`, `end_of_support`, `end_of_sale`, `end_of_life`, `retired` | The lists of filtered product status, if empty only products with status public_beta, general_availability, preview, end_of_new_features, end_of_growth, end_of_deployment, end_of_support, end_of_sale, end_of_life or retired will be returned. |
37+
| api-ids.{index} | | Filter products by API IDs. Each ID is matched against product-specific identifiers: `dedibox.offer_id` (converted to string), `elastic_metal.offer_id`, `apple_silicon.server_type`, `instance.offer_id`, and `load_balancer.node.offer_id`. Products that do not support API ID filtering are excluded from the results. If empty, no filtering is applied. |
3738

3839

3940

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/moby/buildkit v0.29.0
2626
github.com/moby/go-archive v0.2.0
2727
github.com/opencontainers/go-digest v1.0.0
28-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36.0.20260407090446-d29e7ae732bb
28+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36.0.20260407155337-c7324437042d
2929
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3030
github.com/spf13/cobra v1.10.2
3131
github.com/spf13/pflag v1.0.10

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7
476476
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
477477
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
478478
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
479-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36.0.20260407090446-d29e7ae732bb h1:9XAQvVL7DigZy2SdWlW1FCA0BCo8vFtW6xaHiPTKL4g=
480-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36.0.20260407090446-d29e7ae732bb/go.mod h1:SKcIU6lqwljcpjOlTnSfMFfURd/XT+08spQyqN9OTWA=
479+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36.0.20260407155337-c7324437042d h1:9sT/BfLItlKOO2JpfrIjjV4I9+f1byWEBPob9CFYNDQ=
480+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36.0.20260407155337-c7324437042d/go.mod h1:SKcIU6lqwljcpjOlTnSfMFfURd/XT+08spQyqN9OTWA=
481481
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
482482
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
483483
github.com/secure-systems-lab/go-securesystemslib v0.10.0 h1:l+H5ErcW0PAehBNrBxoGv1jjNpGYdZ9RcheFkB2WI14=

internal/namespaces/product_catalog/v2alpha1/product_catalog_cli.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ func productCatalogProductList() *core.Command {
129129
"retired",
130130
},
131131
},
132+
{
133+
Name: "api-ids.{index}",
134+
Short: `Filter products by API IDs. Each ID is matched against product-specific identifiers: ` + "`" + `dedibox.offer_id` + "`" + ` (converted to string), ` + "`" + `elastic_metal.offer_id` + "`" + `, ` + "`" + `apple_silicon.server_type` + "`" + `, ` + "`" + `instance.offer_id` + "`" + `, and ` + "`" + `load_balancer.node.offer_id` + "`" + `. Products that do not support API ID filtering are excluded from the results. If empty, no filtering is applied.`,
135+
Required: false,
136+
Deprecated: false,
137+
Positional: false,
138+
},
132139
},
133140
Run: func(ctx context.Context, args any) (i any, e error) {
134141
request := args.(*product_catalog.PublicCatalogAPIListPublicCatalogProductsRequest)

0 commit comments

Comments
 (0)