From c0be288104217829d35e568eda5cf1fea1332b65 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 6 Mar 2025 15:34:27 +0000 Subject: [PATCH] feat: update generated APIs --- ...-usage-audit-trail-event-list-usage.golden | 3 +- ...l-usage-billing-discount-list-usage.golden | 5 ++- ...-vpc-gw-gateway-migrate-to-v2-usage.golden | 19 ++++++++++ ...test-all-usage-vpc-gw-gateway-usage.golden | 1 + docs/commands/audit-trail.md | 3 +- docs/commands/billing.md | 5 ++- docs/commands/vpc-gw.md | 21 +++++++++++ internal/namespaces/vpcgw/v1/vpcgw_cli.go | 37 +++++++++++++++++++ 8 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 cmd/scw/testdata/test-all-usage-vpc-gw-gateway-migrate-to-v2-usage.golden diff --git a/cmd/scw/testdata/test-all-usage-audit-trail-event-list-usage.golden b/cmd/scw/testdata/test-all-usage-audit-trail-event-list-usage.golden index 469043f97b..f465bdc5b5 100644 --- a/cmd/scw/testdata/test-all-usage-audit-trail-event-list-usage.golden +++ b/cmd/scw/testdata/test-all-usage-audit-trail-event-list-usage.golden @@ -8,7 +8,7 @@ USAGE: ARGS: [project-id] (Optional) ID of the Project containing the Audit Trail events [resource-type] (Optional) Returns a paginated list of Scaleway resources' features (unknown_type | secm_secret | secm_secret_version | kube_cluster | kube_pool | kube_node | kube_acl | keym_key | iam_user | iam_application | iam_group | iam_policy | iam_api_key | iam_ssh_key | secret_manager_secret | secret_manager_version | key_manager_key) - [method-name] (Optional) Name of the method or the API call performed + [method-name] (Optional) Name of the method of the API call performed [status] (Optional) HTTP status code of the request. Returns either `200` if the request was successful or `403` if the permission was denied [recorded-after] (Optional) The `recorded_after` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns `one hour ago` by default [recorded-before] (Optional) The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Returns `now` by default @@ -16,6 +16,7 @@ ARGS: [page-size] [page-token] [product-name] (Optional) Name of the Scaleway resource in a hyphenated format + [service-name] (Optional) Name of the service of the API call performed [organization-id] Organization ID to use. If none is passed the default organization ID will be used [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams) diff --git a/cmd/scw/testdata/test-all-usage-billing-discount-list-usage.golden b/cmd/scw/testdata/test-all-usage-billing-discount-list-usage.golden index 30eb822bcb..9b9518b889 100644 --- a/cmd/scw/testdata/test-all-usage-billing-discount-list-usage.golden +++ b/cmd/scw/testdata/test-all-usage-billing-discount-list-usage.golden @@ -1,6 +1,9 @@ 🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ -List all discounts for your organization and usable categories, products, offers, references, regions and zones where the discount can be applied. +List all discounts for your Organization and usable categories, products, offers, references, regions and zones where the discount can be applied. As a reseller: +- If you do not specify an `organization_id` you will list the discounts applied to your own Organization and your customers +- If you indicate your `organization_id` you will list only the discounts applied to your Organization +- If you indicate `the organization_id` of one of your customers, you will list the discounts applied to their Organization. USAGE: scw billing discount list [arg=value ...] diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-migrate-to-v2-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-migrate-to-v2-usage.golden new file mode 100644 index 0000000000..0c56910c03 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-migrate-to-v2-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent. + +USAGE: + scw vpc-gw gateway migrate-to-v2 [arg=value ...] + +ARGS: + gateway-id ID of the gateway to put into IPAM mode + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2 | pl-waw-3) + +FLAGS: + -h, --help help for migrate-to-v2 + +GLOBAL FLAGS: + -c, --config string The path to the config file + -D, --debug Enable debug mode + -o, --output string Output format: json or human, see 'scw help output' for more info (default "human") + -p, --profile string The config profile to use diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-usage.golden index cb1c8d95d3..556001fdba 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-usage.golden @@ -11,6 +11,7 @@ AVAILABLE COMMANDS: enable-ip-mobility Upgrade a Public Gateway to IP mobility get Get a Public Gateway list List Public Gateways + migrate-to-v2 Put a Public Gateway in IPAM mode refresh-ssh-keys Refresh a Public Gateway's SSH keys update Update a Public Gateway upgrade Upgrade a Public Gateway to the latest version and/or to a different commercial offer type diff --git a/docs/commands/audit-trail.md b/docs/commands/audit-trail.md index 61c10fbeed..9823351c69 100644 --- a/docs/commands/audit-trail.md +++ b/docs/commands/audit-trail.md @@ -30,7 +30,7 @@ scw audit-trail event list [arg=value ...] |------|---|-------------| | project-id | | (Optional) ID of the Project containing the Audit Trail events | | resource-type | One of: `unknown_type`, `secm_secret`, `secm_secret_version`, `kube_cluster`, `kube_pool`, `kube_node`, `kube_acl`, `keym_key`, `iam_user`, `iam_application`, `iam_group`, `iam_policy`, `iam_api_key`, `iam_ssh_key`, `secret_manager_secret`, `secret_manager_version`, `key_manager_key` | (Optional) Returns a paginated list of Scaleway resources' features | -| method-name | | (Optional) Name of the method or the API call performed | +| method-name | | (Optional) Name of the method of the API call performed | | status | | (Optional) HTTP status code of the request. Returns either `200` if the request was successful or `403` if the permission was denied | | recorded-after | | (Optional) The `recorded_after` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns `one hour ago` by default | | recorded-before | | (Optional) The `recorded_before` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Returns `now` by default | @@ -38,6 +38,7 @@ scw audit-trail event list [arg=value ...] | page-size | | | | page-token | | | | product-name | | (Optional) Name of the Scaleway resource in a hyphenated format | +| service-name | | (Optional) Name of the service of the API call performed | | organization-id | | Organization ID to use. If none is passed the default organization ID will be used | | region | Default: `fr-par`
One of: `fr-par`, `nl-ams` | Region to target. If none is passed will use default region from the config | diff --git a/docs/commands/billing.md b/docs/commands/billing.md index bb5955f730..cd31ce63b4 100644 --- a/docs/commands/billing.md +++ b/docs/commands/billing.md @@ -70,7 +70,10 @@ Discount management commands. ### List discounts -List all discounts for your organization and usable categories, products, offers, references, regions and zones where the discount can be applied. +List all discounts for your Organization and usable categories, products, offers, references, regions and zones where the discount can be applied. As a reseller: +- If you do not specify an `organization_id` you will list the discounts applied to your own Organization and your customers +- If you indicate your `organization_id` you will list only the discounts applied to your Organization +- If you indicate `the organization_id` of one of your customers, you will list the discounts applied to their Organization. **Usage:** diff --git a/docs/commands/vpc-gw.md b/docs/commands/vpc-gw.md index d672734595..b869b16464 100644 --- a/docs/commands/vpc-gw.md +++ b/docs/commands/vpc-gw.md @@ -21,6 +21,7 @@ This API allows you to manage your Public Gateways. - [Upgrade a Public Gateway to IP mobility](#upgrade-a-public-gateway-to-ip-mobility) - [Get a Public Gateway](#get-a-public-gateway) - [List Public Gateways](#list-public-gateways) + - [Put a Public Gateway in IPAM mode](#put-a-public-gateway-in-ipam-mode) - [Refresh a Public Gateway's SSH keys](#refresh-a-public-gateway's-ssh-keys) - [Update a Public Gateway](#update-a-public-gateway) - [Upgrade a Public Gateway to the latest version and/or to a different commercial offer type](#upgrade-a-public-gateway-to-the-latest-version-andor-to-a-different-commercial-offer-type) @@ -438,6 +439,26 @@ scw vpc-gw gateway list [arg=value ...] +### Put a Public Gateway in IPAM mode + +Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent. + +**Usage:** + +``` +scw vpc-gw gateway migrate-to-v2 [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| gateway-id | Required | ID of the gateway to put into IPAM mode | +| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config | + + + ### Refresh a Public Gateway's SSH keys Refresh the SSH keys of a given Public Gateway, specified by its gateway ID. This adds any new SSH keys in the gateway's Scaleway Project to the gateway itself. diff --git a/internal/namespaces/vpcgw/v1/vpcgw_cli.go b/internal/namespaces/vpcgw/v1/vpcgw_cli.go index c4e1ddd43d..31680f014e 100644 --- a/internal/namespaces/vpcgw/v1/vpcgw_cli.go +++ b/internal/namespaces/vpcgw/v1/vpcgw_cli.go @@ -63,6 +63,7 @@ func GetGeneratedCommands() *core.Commands { vpcGwIPUpdate(), vpcGwIPDelete(), vpcGwGatewayRefreshSSHKeys(), + vpcGwGatewayMigrateToV2(), ) } func vpcGwRoot() *core.Command { @@ -2259,3 +2260,39 @@ func vpcGwGatewayRefreshSSHKeys() *core.Command { }, } } + +func vpcGwGatewayMigrateToV2() *core.Command { + return &core.Command{ + Short: `Put a Public Gateway in IPAM mode`, + Long: `Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent.`, + Namespace: "vpc-gw", + Resource: "gateway", + Verb: "migrate-to-v2", + // Deprecated: false, + ArgsType: reflect.TypeOf(vpcgw.MigrateToV2Request{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "gateway-id", + Short: `ID of the gateway to put into IPAM mode`, + Required: true, + Deprecated: false, + Positional: true, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZoneNlAms3, scw.ZonePlWaw1, scw.ZonePlWaw2, scw.ZonePlWaw3), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*vpcgw.MigrateToV2Request) + + client := core.ExtractClient(ctx) + api := vpcgw.NewAPI(client) + e = api.MigrateToV2(request) + if e != nil { + return nil, e + } + return &core.SuccessResult{ + Resource: "gateway", + Verb: "migrate-to-v2", + }, nil + }, + } +}