diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-create-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-create-usage#01.golden new file mode 100644 index 0000000000..251e348adf --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-create-usage#01.golden @@ -0,0 +1,28 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Create a new Public Gateway in the specified Scaleway Project, defining its **name**, **type** and other configuration details such as whether to enable SSH bastion. + +USAGE: + scw vpc-gw gateway create [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [name=] Name for the gateway + [tags.{index}] Tags for the gateway + [type=VPC-GW-S] Gateway type (commercial offer type) + [upstream-dns-servers.{index}] Array of DNS server IP addresses to override the gateway's default recursive DNS servers + [ip-id] Existing IP address to attach to the gateway + [enable-smtp] Defines whether SMTP traffic should be allowed pass through the gateway + [enable-bastion] Defines whether SSH bastion should be enabled the gateway + [bastion-port] Port of the SSH bastion + [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 create + -w, --wait wait until the gateway is ready + +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-delete-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-delete-usage#01.golden new file mode 100644 index 0000000000..80fd2ba5cd --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-delete-usage#01.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete an existing Public Gateway, specified by its gateway ID. This action is irreversible. + +USAGE: + scw vpc-gw gateway delete [arg=value ...] + +ARGS: + gateway-id ID of the gateway to delete + [cleanup-dhcp] Defines whether to clean up attached DHCP configurations (if any, and if not attached to another Gateway Network) + [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 delete + +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-get-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-get-usage#01.golden new file mode 100644 index 0000000000..8eb2a0de32 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-get-usage#01.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get details of a Public Gateway, specified by its gateway ID. The response object contains full details of the gateway, including its **name**, **type**, **status** and more. + +USAGE: + scw vpc-gw gateway get [arg=value ...] + +ARGS: + gateway-id ID of the gateway to fetch + [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 get + +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-list-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-list-usage#01.golden new file mode 100644 index 0000000000..9553ff5450 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-list-usage#01.golden @@ -0,0 +1,26 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +List Public Gateways in a given Scaleway Organization or Project. By default, results are displayed in ascending order of creation date. + +USAGE: + scw vpc-gw gateway list [arg=value ...] + +ARGS: + [order-by] Order in which to return results (created_at_asc | created_at_desc | name_asc | name_desc | type_asc | type_desc | status_asc | status_desc) + [project-id] Include only gateways in this Project + [name] Filter for gateways which have this search term in their name + [tags.{index}] Filter for gateways with these tags + [type] Filter for gateways of this type + [status] Filter for gateways with this current status. Use `unknown` to include all statuses (unknown | stopped | allocating | configuring | running | stopping | failed | deleting | deleted | locked) + [private-network-id] Filter for gateways attached to this Private nNetwork + [organization-id] Include only gateways in this Organization + [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 | all) + +FLAGS: + -h, --help help for list + +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-network-create-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-create-usage#01.golden new file mode 100644 index 0000000000..26c6950759 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-create-usage#01.golden @@ -0,0 +1,27 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Attach a specific Public Gateway to a specific Private Network (create a GatewayNetwork). You can configure parameters for the connection including DHCP settings, whether to enable masquerade (dynamic NAT), and more. + +USAGE: + scw vpc-gw gateway-network create [arg=value ...] + +ARGS: + [gateway-id] Public Gateway to connect + [private-network-id] Private Network to connect + [enable-masquerade] Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. + [enable-dhcp] Defines whether to enable DHCP on this Private Network. + [dhcp-id] ID of an existing DHCP configuration object to use for this GatewayNetwork + [address] Static IP address in CIDR format to to use without DHCP + [ipam-config.push-default-route] Enabling the default route also enables masquerading + [ipam-config.ipam-ip-id] Use this IPAM-booked IP ID as the Gateway's IP in this Private Network + [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 create + -w, --wait wait until the gateway-network is ready + +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-network-delete-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-delete-usage#01.golden new file mode 100644 index 0000000000..856af57a4f --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-delete-usage#01.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Detach a given Public Gateway from a given Private Network, i.e. delete a GatewayNetwork specified by a gateway_network_id. + +USAGE: + scw vpc-gw gateway-network delete [arg=value ...] + +ARGS: + gateway-network-id ID of the GatewayNetwork to delete + [cleanup-dhcp] Defines whether to clean up attached DHCP configurations (if any, and if not attached to another Gateway Network) + [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 delete + -w, --wait wait until the gateway-network is ready + +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-network-get-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-get-usage#01.golden new file mode 100644 index 0000000000..3742a18b54 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-get-usage#01.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get details of a given connection between a Public Gateway and a Private Network (this connection = a GatewayNetwork), specified by its `gateway_network_id`. The response object contains details of the connection including the IDs of the Public Gateway and Private Network, the dates the connection was created/updated and its configuration settings. + +USAGE: + scw vpc-gw gateway-network get [arg=value ...] + +ARGS: + gateway-network-id ID of the GatewayNetwork to fetch + [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 get + +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-network-list-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-list-usage#01.golden new file mode 100644 index 0000000000..6552109ba1 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-list-usage#01.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +List the connections between Public Gateways and Private Networks (a connection = a GatewayNetwork). You can choose to filter by `gateway-id` to list all Private Networks attached to the specified Public Gateway, or by `private_network_id` to list all Public Gateways attached to the specified Private Network. Other query parameters are also available. The result is an array of GatewayNetwork objects, each giving details of the connection between a given Public Gateway and a given Private Network. + +USAGE: + scw vpc-gw gateway-network list [arg=value ...] + +ARGS: + [order-by] Order in which to return results (created_at_asc | created_at_desc | status_asc | status_desc) + [gateway-id] Filter for GatewayNetworks connected to this gateway + [private-network-id] Filter for GatewayNetworks connected to this Private Network + [enable-masquerade] Filter for GatewayNetworks with this `enable_masquerade` setting + [dhcp-id] Filter for GatewayNetworks using this DHCP configuration + [status] Filter for GatewayNetworks with this current status this status. Use `unknown` to include all statuses (unknown | created | attaching | configuring | ready | detaching | deleted) + [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 | all) + +FLAGS: + -h, --help help for list + +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-network-list-usage.cassette.yaml b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-list-usage.cassette.yaml new file mode 100644 index 0000000000..05228242b1 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-list-usage.cassette.yaml @@ -0,0 +1,35 @@ +--- +version: 1 +interactions: +- request: + body: '{"access_key":"SCWBDFF054RNNE8204AJ","secret_key":null,"description":"my-key","created_at":"2022-06-10T08:39:27.845066Z","updated_at":"2022-07-05T15:12:12.987880Z","expires_at":null,"default_project_id":"564aa517-68b0-4fd7-8c8c-d21c4bcdcbd5","editable":true,"creation_ip":"51.159.46.153","application_id":"531f5518-a0a5-44c2-b790-a9975505c89d"}' + form: {} + headers: + User-Agent: + - scaleway-sdk-go/v1.0.0-beta.7+dev (go1.20.4; darwin; amd64) cli-e2e-test + url: https://api.scaleway.com/iam/v1alpha1/api-keys/SCWXXXXXXXXXXXXXXXXX + method: GET + response: + body: '{"access_key":"SCWBDFF054RNNE8204AJ","secret_key":null,"description":"my-key","created_at":"2022-06-10T08:39:27.845066Z","updated_at":"2022-07-05T15:12:12.987880Z","expires_at":null,"default_project_id":"564aa517-68b0-4fd7-8c8c-d21c4bcdcbd5","editable":true,"creation_ip":"51.159.46.153","application_id":"531f5518-a0a5-44c2-b790-a9975505c89d"}' + headers: + Content-Length: + - "344" + Content-Security-Policy: + - default-src 'none'; frame-ancestors 'none' + Content-Type: + - application/json + Date: + - Wed, 14 Jun 2023 13:56:47 GMT + Server: + - Scaleway API-Gateway + Strict-Transport-Security: + - max-age=63072000 + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-Request-Id: + - 8dedeae5-ec2d-4679-95c6-bc9e7089d96a + status: 200 OK + code: 200 + duration: "" diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-update-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-update-usage#01.golden new file mode 100644 index 0000000000..1930b685f2 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-update-usage#01.golden @@ -0,0 +1,25 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Update the configuration parameters of a connection between a given Public Gateway and Private Network (the connection = a GatewayNetwork). Updatable parameters include DHCP settings and whether to enable traffic masquerade (dynamic NAT). + +USAGE: + scw vpc-gw gateway-network update [arg=value ...] + +ARGS: + gateway-network-id ID of the GatewayNetwork to update + [enable-masquerade] Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. + [enable-dhcp] Defines whether to enable DHCP on this Private Network. + [dhcp-id] ID of the new DHCP configuration object to use with this GatewayNetwork + [address] New static IP address + [ipam-config.push-default-route] Enabling the default route also enables masquerading + [ipam-config.ipam-ip-id] Use this IPAM-booked IP ID as the Gateway's IP in this Private Network + [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 update + +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-network-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-usage#01.golden new file mode 100644 index 0000000000..213fffe9c5 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-usage#01.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +A Gateway Network represents the connection of a Private Network to a Public Gateway. It holds configuration options relative to this specific connection, such as the DHCP configuration. + +USAGE: + scw vpc-gw gateway-network + +AVAILABLE COMMANDS: + create-v2 Attach a Public Gateway to a Private Network + delete-v2 Detach a Public Gateway from a Private Network + get-v2 Get a Public Gateway connection to a Private Network + list-v2 List Public Gateway connections to Private Networks + update-v2 Update a Public Gateway's connection to a Private Network + +FLAGS: + -h, --help help for gateway-network + +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 + +Use "scw vpc-gw gateway-network [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-usage.golden index 992d88bd96..213fffe9c5 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-network-usage.golden @@ -6,11 +6,11 @@ USAGE: scw vpc-gw gateway-network AVAILABLE COMMANDS: - create Attach a Public Gateway to a Private Network - delete Detach a Public Gateway from a Private Network - get Get a Public Gateway connection to a Private Network - list List Public Gateway connections to Private Networks - update Update a Public Gateway's connection to a Private Network + create-v2 Attach a Public Gateway to a Private Network + delete-v2 Detach a Public Gateway from a Private Network + get-v2 Get a Public Gateway connection to a Private Network + list-v2 List Public Gateway connections to Private Networks + update-v2 Update a Public Gateway's connection to a Private Network FLAGS: -h, --help help for gateway-network diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-refresh-ssh-keys-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-refresh-ssh-keys-usage#01.golden new file mode 100644 index 0000000000..033e5ae1a4 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-refresh-ssh-keys-usage#01.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +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. + +USAGE: + scw vpc-gw gateway refresh-ssh-keys [arg=value ...] + +ARGS: + gateway-id ID of the gateway to refresh SSH keys on + [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 refresh-ssh-keys + +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-type-list-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-type-list-usage#01.golden new file mode 100644 index 0000000000..5f39215674 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-type-list-usage#01.golden @@ -0,0 +1,18 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +List the different Public Gateway commercial offer types available at Scaleway. The response is an array of objects describing the name and technical details of each available gateway type. + +USAGE: + scw vpc-gw gateway-type list [arg=value ...] + +ARGS: + [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 list + +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-type-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-type-usage#01.golden new file mode 100644 index 0000000000..7ddd06f0f0 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-type-usage#01.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Public Gateways come in various shapes, sizes and prices, which are described by gateway types. They represent the different commercial offer types for Public Gateways available at Scaleway. + +USAGE: + scw vpc-gw gateway-type + +AVAILABLE COMMANDS: + list-v2 List Public Gateway types + +FLAGS: + -h, --help help for gateway-type + +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 + +Use "scw vpc-gw gateway-type [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-type-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-type-usage.golden index 2fccb628db..7ddd06f0f0 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-type-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-type-usage.golden @@ -6,7 +6,7 @@ USAGE: scw vpc-gw gateway-type AVAILABLE COMMANDS: - list List Public Gateway types + list-v2 List Public Gateway types FLAGS: -h, --help help for gateway-type diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-update-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-update-usage#01.golden new file mode 100644 index 0000000000..bc3d5be403 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-update-usage#01.golden @@ -0,0 +1,25 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Update the parameters of an existing Public Gateway, for example, its **name**, **tags**, **SSH bastion configuration**, and **DNS servers**. + +USAGE: + scw vpc-gw gateway update [arg=value ...] + +ARGS: + gateway-id ID of the gateway to update + [name] Name for the gateway + [tags.{index}] Tags for the gateway + [upstream-dns-servers.{index}] Array of DNS server IP addresses to override the gateway's default recursive DNS servers + [enable-bastion] Defines whether SSH bastion should be enabled the gateway + [bastion-port] Port of the SSH bastion + [enable-smtp] Defines whether SMTP traffic should be allowed to pass through the gateway + [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 update + +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-upgrade-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-upgrade-usage#01.golden new file mode 100644 index 0000000000..52eec10c5b --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-upgrade-usage#01.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Upgrade a given Public Gateway to the newest software version or to a different commercial offer type. This applies the latest bugfixes and features to your Public Gateway. Note that gateway service will be interrupted during the update. + +USAGE: + scw vpc-gw gateway upgrade [arg=value ...] + +ARGS: + gateway-id ID of the gateway to upgrade + [type] Gateway type (commercial offer) + [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 upgrade + +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#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-usage#01.golden new file mode 100644 index 0000000000..5e830ecae4 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-gateway-usage#01.golden @@ -0,0 +1,27 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Public Gateways are building blocks for your infrastructure on Scaleway's shared public cloud. They provide a set of managed network services and features for Scaleway's Private Networks such as DHCP, NAT and routing. + +USAGE: + scw vpc-gw gateway + +AVAILABLE COMMANDS: + create-v2 Create a Public Gateway + delete-v2 Delete a Public Gateway + get-v2 Get a Public Gateway + list-v2 List Public Gateways + migrate-to-v2 Put a Public Gateway in IPAM mode + refresh-ssh-keys-v2 Refresh a Public Gateway's SSH keys + update-v2 Update a Public Gateway + upgrade-v2 Upgrade a Public Gateway to the latest version and/or to a different commercial offer type + +FLAGS: + -h, --help help for gateway + +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 + +Use "scw vpc-gw gateway [command] --help" for more information about a command. 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 556001fdba..5e830ecae4 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 @@ -6,15 +6,14 @@ USAGE: scw vpc-gw gateway AVAILABLE COMMANDS: - create Create a Public Gateway - delete Delete a Public Gateway - 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 + create-v2 Create a Public Gateway + delete-v2 Delete a Public Gateway + get-v2 Get a Public Gateway + list-v2 List Public Gateways + migrate-to-v2 Put a Public Gateway in IPAM mode + refresh-ssh-keys-v2 Refresh a Public Gateway's SSH keys + update-v2 Update a Public Gateway + upgrade-v2 Upgrade a Public Gateway to the latest version and/or to a different commercial offer type FLAGS: -h, --help help for gateway diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-ip-create-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-create-usage#01.golden new file mode 100644 index 0000000000..0f19036b24 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-create-usage#01.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Create (reserve) a new flexible IP address that can be used for a Public Gateway in a specified Scaleway Project. + +USAGE: + scw vpc-gw ip create [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [tags.{index}] Tags to give to the IP address + [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 create + +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-ip-delete-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-delete-usage#01.golden new file mode 100644 index 0000000000..bc955fcb9a --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-delete-usage#01.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete a flexible IP address from your account. This action is irreversible. + +USAGE: + scw vpc-gw ip delete [arg=value ...] + +ARGS: + ip-id ID of the IP address to delete + [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 delete + +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-ip-get-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-get-usage#01.golden new file mode 100644 index 0000000000..754c0f5389 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-get-usage#01.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get details of a Public Gateway flexible IP address, identified by its IP ID. The response object contains information including which (if any) Public Gateway using this IP address, the reverse and various other metadata. + +USAGE: + scw vpc-gw ip get [arg=value ...] + +ARGS: + ip-id ID of the IP address to get + [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 get + +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-ip-list-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-list-usage#01.golden new file mode 100644 index 0000000000..15a34a0abe --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-list-usage#01.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +List Public Gateway flexible IP addresses. A number of filter options are available for limiting results in the response. + +USAGE: + scw vpc-gw ip list [arg=value ...] + +ARGS: + [order-by] Order in which to return results (created_at_asc | created_at_desc | ip_asc | ip_desc | reverse_asc | reverse_desc) + [project-id] Filter for IP addresses in this Project + [tags.{index}] Filter for IP addresses with these tags + [reverse] Filter for IP addresses that have a reverse containing this string + [is-free] Filter based on whether the IP is attached to a gateway or not + [organization-id] Filter for IP addresses in this Organization + [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 | all) + +FLAGS: + -h, --help help for list + +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-ip-update-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-update-usage#01.golden new file mode 100644 index 0000000000..d29d093a9a --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-update-usage#01.golden @@ -0,0 +1,22 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Update details of an existing flexible IP address, including its tags, reverse and the Public Gateway it is assigned to. + +USAGE: + scw vpc-gw ip update [arg=value ...] + +ARGS: + ip-id ID of the IP address to update + [tags.{index}] Tags to give to the IP address + [reverse] Reverse to set on the address. Empty string to unset + [gateway-id] Gateway to attach the IP address to. Empty string to detach + [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 update + +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-ip-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-usage#01.golden new file mode 100644 index 0000000000..3f59475df3 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-usage#01.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Public, flexible IP addresses for Public Gateways, allowing the gateway to reach the public internet, as well as forward (masquerade) traffic from member devices of attached Private Networks. + +USAGE: + scw vpc-gw ip + +AVAILABLE COMMANDS: + create-v2 Reserve an IP + delete-v2 Delete an IP + get-v2 Get an IP + list-v2 List IPs + update-v2 Update an IP + +FLAGS: + -h, --help help for ip + +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 + +Use "scw vpc-gw ip [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-ip-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-usage.golden index e59c5c4268..3f59475df3 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-gw-ip-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-ip-usage.golden @@ -6,11 +6,11 @@ USAGE: scw vpc-gw ip AVAILABLE COMMANDS: - create Reserve an IP - delete Delete an IP - get Get an IP - list List IPs - update Update an IP + create-v2 Reserve an IP + delete-v2 Delete an IP + get-v2 Get an IP + list-v2 List IPs + update-v2 Update an IP FLAGS: -h, --help help for ip diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-create-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-create-usage#01.golden new file mode 100644 index 0000000000..7e310d00c2 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-create-usage#01.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Create a new PAT rule on a specified Public Gateway, defining the protocol to use, public port to listen on, and private port / IP address to map to. + +USAGE: + scw vpc-gw pat-rule create [arg=value ...] + +ARGS: + [gateway-id] ID of the Gateway on which to create the rule + [public-port] Public port to listen on + [private-ip] Private IP to forward data to + [private-port] Private port to translate to + [protocol] Protocol the rule should apply to (unknown | both | tcp | udp) + [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 create + +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-pat-rule-delete-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-delete-usage#01.golden new file mode 100644 index 0000000000..bbeef41458 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-delete-usage#01.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete a PAT rule, identified by its PAT rule ID. This action is irreversible. + +USAGE: + scw vpc-gw pat-rule delete [arg=value ...] + +ARGS: + pat-rule-id ID of the PAT rule to delete + [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 delete + +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-pat-rule-get-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-get-usage#01.golden new file mode 100644 index 0000000000..420d6dcfc0 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-get-usage#01.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get a PAT rule, specified by its PAT rule ID. The response object gives full details of the PAT rule, including the Public Gateway it belongs to and the configuration settings in terms of public / private ports, private IP and protocol. + +USAGE: + scw vpc-gw pat-rule get [arg=value ...] + +ARGS: + pat-rule-id ID of the PAT rule to get + [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 get + +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-pat-rule-list-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-list-usage#01.golden new file mode 100644 index 0000000000..3c3689ace0 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-list-usage#01.golden @@ -0,0 +1,22 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +List PAT rules. You can filter by gateway ID to list all PAT rules for a particular gateway, or filter for PAT rules targeting a specific IP address or using a specific protocol. + +USAGE: + scw vpc-gw pat-rule list [arg=value ...] + +ARGS: + [order-by] Order in which to return results (created_at_asc | created_at_desc | public_port_asc | public_port_desc) + [gateway-id] Filter for PAT rules on this Gateway + [private-ip] Filter for PAT rules targeting this private ip + [protocol] Filter for PAT rules with this protocol (unknown | both | tcp | udp) + [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 | all) + +FLAGS: + -h, --help help for list + +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-pat-rule-set-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-set-usage#01.golden new file mode 100644 index 0000000000..001cecaaa1 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-set-usage#01.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Set a definitive list of PAT rules attached to a Public Gateway. Each rule is identified by its public port and protocol. This will sync the current PAT rule list on the gateway with the new list, creating, updating or deleting PAT rules accordingly. + +USAGE: + scw vpc-gw pat-rule set [arg=value ...] + +ARGS: + [gateway-id] ID of the gateway on which to set the PAT rules + [pat-rules.{index}.public-port] Public port to listen on + [pat-rules.{index}.private-ip] Private IP to forward data to + [pat-rules.{index}.private-port] Private port to translate to + [pat-rules.{index}.protocol] Protocol the rule should apply to (unknown | both | tcp | udp) + [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 set + +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-pat-rule-update-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-update-usage#01.golden new file mode 100644 index 0000000000..3bccb1731b --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-update-usage#01.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Update a PAT rule, specified by its PAT rule ID. Configuration settings including private/public port, private IP address and protocol can all be updated. + +USAGE: + scw vpc-gw pat-rule update [arg=value ...] + +ARGS: + pat-rule-id ID of the PAT rule to update + [public-port] Public port to listen on + [private-ip] Private IP to forward data to + [private-port] Private port to translate to + [protocol] Protocol the rule should apply to (unknown | both | tcp | udp) + [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 update + +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-pat-rule-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-usage#01.golden new file mode 100644 index 0000000000..e280ed5d60 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-usage#01.golden @@ -0,0 +1,25 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +PAT (Port Address Translation) rules, aka static NAT rules, belong to a specified Public Gateway. They define the forwarding of a public port to a specific device on a Private Network, enabling enables ingress traffic from the public Internet to reach the correct device in the Private Network. + +USAGE: + scw vpc-gw pat-rule + +AVAILABLE COMMANDS: + create-v2 Create a PAT rule + delete-v2 Delete a PAT rule + get-v2 Get a PAT rule + list-v2 List PAT rules + set-v2 Set all PAT rules + update-v2 Update a PAT rule + +FLAGS: + -h, --help help for pat-rule + +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 + +Use "scw vpc-gw pat-rule [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-usage.golden index 240ae10fe9..e280ed5d60 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-pat-rule-usage.golden @@ -6,12 +6,12 @@ USAGE: scw vpc-gw pat-rule AVAILABLE COMMANDS: - create Create a PAT rule - delete Delete a PAT rule - get Get a PAT rule - list List PAT rules - set Set all PAT rules - update Update a PAT rule + create-v2 Create a PAT rule + delete-v2 Delete a PAT rule + get-v2 Get a PAT rule + list-v2 List PAT rules + set-v2 Set all PAT rules + update-v2 Update a PAT rule FLAGS: -h, --help help for pat-rule diff --git a/cmd/scw/testdata/test-all-usage-vpc-gw-usage#01.golden b/cmd/scw/testdata/test-all-usage-vpc-gw-usage#01.golden new file mode 100644 index 0000000000..8e3272589e --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-gw-usage#01.golden @@ -0,0 +1,26 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +This API allows you to manage your Public Gateways. + +USAGE: + scw vpc-gw + +AVAILABLE COMMANDS: + dhcp DHCP configuration management + dhcp-entry DHCP entries management + gateway Public Gateway management + gateway-network Gateway Networks management + gateway-type Gateway types information + ip IP address management + pat-rule PAT rules management + +FLAGS: + -h, --help help for vpc-gw + +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 + +Use "scw vpc-gw [command] --help" for more information about a command. diff --git a/commands/commands.go b/commands/commands.go index cb1d9ffd88..224f74c006 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -50,6 +50,7 @@ import ( versionNamespace "github.com/scaleway/scaleway-cli/v2/internal/namespaces/version" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpc/v2" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpcgw/v1" + vpcgwV2 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpcgw/v2" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/webhosting/v1" "github.com/scaleway/scaleway-sdk-go/scw" ) @@ -91,6 +92,7 @@ func GetCommands() *core.Commands { container.GetCommands(), function.GetCommands(), vpcgw.GetCommands(), + vpcgwV2.GetCommands(), redis.GetCommands(), secret.GetCommands(), keymanager.GetCommands(), diff --git a/docs/commands/vpc-gw.md b/docs/commands/vpc-gw.md index b869b16464..351ff5e8c9 100644 --- a/docs/commands/vpc-gw.md +++ b/docs/commands/vpc-gw.md @@ -18,7 +18,6 @@ This API allows you to manage your Public Gateways. - [Public Gateway management](#public-gateway-management) - [Create a Public Gateway](#create-a-public-gateway) - [Delete a Public Gateway](#delete-a-public-gateway) - - [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) @@ -320,7 +319,7 @@ scw vpc-gw dhcp-entry update [arg=value ...] ## Public Gateway management -Public Gateways are building blocks for your infrastructure on Scaleway's shared public cloud. They provide a set of managed network services and features for Scaleway's Private Networks such as DHCP, NAT and routing. +Public Gateways are building blocks for your infrastructure on Scaleway's shared public cloud. They provide a set of managed network services and features for Scaleway's Private Networks such NAT and PAT rules. ### Create a Public Gateway @@ -342,7 +341,6 @@ scw vpc-gw gateway create [arg=value ...] | name | Default: `` | Name for the gateway | | tags.{index} | | Tags for the gateway | | type | Default: `VPC-GW-S` | Gateway type (commercial offer type) | -| upstream-dns-servers.{index} | | Array of DNS server IP addresses to override the gateway's default recursive DNS servers | | ip-id | | Existing IP address to attach to the gateway | | enable-smtp | | Defines whether SMTP traffic should be allowed pass through the gateway | | enable-bastion | | Defines whether SSH bastion should be enabled the gateway | @@ -367,27 +365,7 @@ scw vpc-gw gateway delete [arg=value ...] | Name | | Description | |------|---|-------------| | gateway-id | Required | ID of the gateway to delete | -| cleanup-dhcp | | Defines whether to clean up attached DHCP configurations (if any, and if not attached to another Gateway Network) | -| 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 | - - - -### Upgrade a Public Gateway to IP mobility - -Upgrade a Public Gateway to IP mobility (move from NAT IP to routed IP). This is idempotent: repeated calls after the first will return no error but have no effect. - -**Usage:** - -``` -scw vpc-gw gateway enable-ip-mobility [arg=value ...] -``` - - -**Args:** - -| Name | | Description | -|------|---|-------------| -| gateway-id | Required | ID of the gateway to upgrade to IP mobility | +| delete-ip | | Defines whether the PGW's IP should be deleted | | 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 | @@ -431,9 +409,10 @@ scw vpc-gw gateway list [arg=value ...] | project-id | | Include only gateways in this Project | | name | | Filter for gateways which have this search term in their name | | tags.{index} | | Filter for gateways with these tags | -| type | | Filter for gateways of this type | -| status | One of: `unknown`, `stopped`, `allocating`, `configuring`, `running`, `stopping`, `failed`, `deleting`, `deleted`, `locked` | Filter for gateways with this current status. Use `unknown` to include all statuses | -| private-network-id | | Filter for gateways attached to this Private nNetwork | +| types.{index} | | Filter for gateways of these types | +| status.{index} | One of: `unknown_status`, `stopped`, `allocating`, `configuring`, `running`, `stopping`, `failed`, `deleting`, `locked` | Filter for gateways with these status. Use `unknown` to include all statuses | +| private-network-ids.{index} | | Filter for gateways attached to these Private Networks | +| include-legacy | | Include also legacy gateways | | organization-id | | Include only gateways in this Organization | | 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`, `all` | Zone to target. If none is passed will use default zone from the config | @@ -497,7 +476,6 @@ scw vpc-gw gateway update [arg=value ...] | gateway-id | Required | ID of the gateway to update | | name | | Name for the gateway | | tags.{index} | | Tags for the gateway | -| upstream-dns-servers.{index} | | Array of DNS server IP addresses to override the gateway's default recursive DNS servers | | enable-bastion | | Defines whether SSH bastion should be enabled the gateway | | bastion-port | | Port of the SSH bastion | | enable-smtp | | Defines whether SMTP traffic should be allowed to pass through the gateway | @@ -528,12 +506,12 @@ scw vpc-gw gateway upgrade [arg=value ...] ## Gateway Networks management -A Gateway Network represents the connection of a Private Network to a Public Gateway. It holds configuration options relative to this specific connection, such as the DHCP configuration. +A Gateway Network represents the connection of a Private Network to a Public Gateway. ### Attach a Public Gateway to a Private Network -Attach a specific Public Gateway to a specific Private Network (create a GatewayNetwork). You can configure parameters for the connection including DHCP settings, whether to enable masquerade (dynamic NAT), and more. +Attach a specific Public Gateway to a specific Private Network (create a GatewayNetwork). You can configure parameters for the connection including whether to enable masquerade (dynamic NAT), and more. **Usage:** @@ -549,11 +527,8 @@ scw vpc-gw gateway-network create [arg=value ...] | gateway-id | | Public Gateway to connect | | private-network-id | | Private Network to connect | | enable-masquerade | | Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. | -| enable-dhcp | | Defines whether to enable DHCP on this Private Network. | -| dhcp-id | | ID of an existing DHCP configuration object to use for this GatewayNetwork | -| address | | Static IP address in CIDR format to to use without DHCP | -| ipam-config.push-default-route | | Enabling the default route also enables masquerading | -| ipam-config.ipam-ip-id | | Use this IPAM-booked IP ID as the Gateway's IP in this Private Network | +| push-default-route | | Enabling the default route also enables masquerading | +| ipam-ip-id | | Use this IPAM-booked IP ID as the Gateway's IP in this Private Network | | 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 | @@ -574,7 +549,6 @@ scw vpc-gw gateway-network delete [arg=value ...] | Name | | Description | |------|---|-------------| | gateway-network-id | Required | ID of the GatewayNetwork to delete | -| cleanup-dhcp | | Defines whether to clean up attached DHCP configurations (if any, and if not attached to another Gateway Network) | | 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 | @@ -615,18 +589,17 @@ scw vpc-gw gateway-network list [arg=value ...] | Name | | Description | |------|---|-------------| | order-by | One of: `created_at_asc`, `created_at_desc`, `status_asc`, `status_desc` | Order in which to return results | -| gateway-id | | Filter for GatewayNetworks connected to this gateway | -| private-network-id | | Filter for GatewayNetworks connected to this Private Network | -| enable-masquerade | | Filter for GatewayNetworks with this `enable_masquerade` setting | -| dhcp-id | | Filter for GatewayNetworks using this DHCP configuration | -| status | One of: `unknown`, `created`, `attaching`, `configuring`, `ready`, `detaching`, `deleted` | Filter for GatewayNetworks with this current status this status. Use `unknown` to include all statuses | +| status.{index} | One of: `unknown_status`, `created`, `attaching`, `configuring`, `ready`, `detaching` | Filter for GatewayNetworks with these status. Use `unknown` to include all statuses | +| gateway-ids.{index} | | Filter for GatewayNetworks connected to these gateways | +| private-network-ids.{index} | | Filter for GatewayNetworks connected to these Private Networks | +| masquerade-enabled | | Filter for GatewayNetworks with this `enable_masquerade` setting | | 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`, `all` | Zone to target. If none is passed will use default zone from the config | ### Update a Public Gateway's connection to a Private Network -Update the configuration parameters of a connection between a given Public Gateway and Private Network (the connection = a GatewayNetwork). Updatable parameters include DHCP settings and whether to enable traffic masquerade (dynamic NAT). +Update the configuration parameters of a connection between a given Public Gateway and Private Network (the connection = a GatewayNetwork). Updatable parameters include whether to enable traffic masquerade (dynamic NAT). **Usage:** @@ -641,11 +614,8 @@ scw vpc-gw gateway-network update [arg=value ...] |------|---|-------------| | gateway-network-id | Required | ID of the GatewayNetwork to update | | enable-masquerade | | Defines whether to enable masquerade (dynamic NAT) on the GatewayNetwork. | -| enable-dhcp | | Defines whether to enable DHCP on this Private Network. | -| dhcp-id | | ID of the new DHCP configuration object to use with this GatewayNetwork | -| address | | New static IP address | -| ipam-config.push-default-route | | Enabling the default route also enables masquerading | -| ipam-config.ipam-ip-id | | Use this IPAM-booked IP ID as the Gateway's IP in this Private Network | +| push-default-route | | Enabling the default route also enables masquerading | +| ipam-ip-id | | Use this IPAM-booked IP ID as the Gateway's IP in this Private Network | | 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 | @@ -755,12 +725,12 @@ scw vpc-gw ip list [arg=value ...] | Name | | Description | |------|---|-------------| -| order-by | One of: `created_at_asc`, `created_at_desc`, `ip_asc`, `ip_desc`, `reverse_asc`, `reverse_desc` | Order in which to return results | +| order-by | One of: `created_at_asc`, `created_at_desc`, `address_asc`, `address_desc`, `reverse_asc`, `reverse_desc` | Order in which to return results | | project-id | | Filter for IP addresses in this Project | | tags.{index} | | Filter for IP addresses with these tags | | reverse | | Filter for IP addresses that have a reverse containing this string | | is-free | | Filter based on whether the IP is attached to a gateway or not | -| organization-id | | Filter for IP addresses in this Organization | +| organization-id | | Include only gateways in this Organization | | 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`, `all` | Zone to target. If none is passed will use default zone from the config | @@ -812,7 +782,7 @@ scw vpc-gw pat-rule create [arg=value ...] | public-port | | Public port to listen on | | private-ip | | Private IP to forward data to | | private-port | | Private port to translate to | -| protocol | One of: `unknown`, `both`, `tcp`, `udp` | Protocol the rule should apply to | +| protocol | One of: `unknown_protocol`, `both`, `tcp`, `udp` | Protocol the rule should apply to | | 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 | @@ -873,9 +843,9 @@ scw vpc-gw pat-rule list [arg=value ...] | Name | | Description | |------|---|-------------| | order-by | One of: `created_at_asc`, `created_at_desc`, `public_port_asc`, `public_port_desc` | Order in which to return results | -| gateway-id | | Filter for PAT rules on this Gateway | -| private-ip | | Filter for PAT rules targeting this private ip | -| protocol | One of: `unknown`, `both`, `tcp`, `udp` | Filter for PAT rules with this protocol | +| gateway-ids.{index} | | Filter for PAT rules on these gateways | +| private-ips.{index} | | Filter for PAT rules targeting these private ips | +| protocol | One of: `unknown_protocol`, `both`, `tcp`, `udp` | Filter for PAT rules with this protocol | | 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`, `all` | Zone to target. If none is passed will use default zone from the config | @@ -899,7 +869,7 @@ scw vpc-gw pat-rule set [arg=value ...] | pat-rules.{index}.public-port | | Public port to listen on | | pat-rules.{index}.private-ip | | Private IP to forward data to | | pat-rules.{index}.private-port | | Private port to translate to | -| pat-rules.{index}.protocol | One of: `unknown`, `both`, `tcp`, `udp` | Protocol the rule should apply to | +| pat-rules.{index}.protocol | One of: `unknown_protocol`, `both`, `tcp`, `udp` | Protocol the rule should apply to | | 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 | @@ -923,7 +893,7 @@ scw vpc-gw pat-rule update [arg=value ...] | public-port | | Public port to listen on | | private-ip | | Private IP to forward data to | | private-port | | Private port to translate to | -| protocol | One of: `unknown`, `both`, `tcp`, `udp` | Protocol the rule should apply to | +| protocol | One of: `unknown_protocol`, `both`, `tcp`, `udp` | Protocol the rule should apply to | | 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 | diff --git a/internal/docgen/docgen.go b/internal/docgen/docgen.go index 3f37800b05..2238f594b1 100644 --- a/internal/docgen/docgen.go +++ b/internal/docgen/docgen.go @@ -73,6 +73,19 @@ func GenerateDocs(commands *core.Commands, outDir string) error { resource.Verbs[c.Verb] = c } + // Fallback: if a resource has no Cmd defined, pick one verb as the fallback + for _, ns := range data.Namespaces { + for _, res := range ns.Resources { + if res.Cmd == nil && len(res.Verbs) > 0 { + for _, cmd := range res.Verbs { + res.Cmd = cmd + + break + } + } + } + } + for name, namespace := range data.Namespaces { fmt.Println("Generating namespace", name) namespaceDoc, err := renderNamespace(namespace) diff --git a/internal/namespaces/vpcgw/v1/custom.go b/internal/namespaces/vpcgw/v1/custom.go index 684b6fe7c3..0e4cd79e6c 100644 --- a/internal/namespaces/vpcgw/v1/custom.go +++ b/internal/namespaces/vpcgw/v1/custom.go @@ -8,6 +8,18 @@ import ( func GetCommands() *core.Commands { cmds := GetGeneratedCommands() + for _, cmd := range cmds.GetAll() { + if cmd.Resource == "" || cmd.Verb == "" { + continue + } + if cmd.Verb == "migrate-to-v2" { + continue + } + if cmd.Resource == "dhcp" || cmd.Resource == "dhcp-entry" { + continue + } + cmd.Hidden = true + } human.RegisterMarshalerFunc(vpcgw.GatewayNetworkStatus(""), human.EnumMarshalFunc(gatewayNetworkStatusMarshalSpecs)) human.RegisterMarshalerFunc(vpcgw.GatewayStatus(""), human.EnumMarshalFunc(gatewayStatusMarshalSpecs)) diff --git a/internal/namespaces/vpcgw/v2/custom.go b/internal/namespaces/vpcgw/v2/custom.go new file mode 100644 index 0000000000..e69a727f42 --- /dev/null +++ b/internal/namespaces/vpcgw/v2/custom.go @@ -0,0 +1,29 @@ +package vpcgw + +import ( + "strings" + + "github.com/scaleway/scaleway-cli/v2/core" + "github.com/scaleway/scaleway-cli/v2/core/human" + "github.com/scaleway/scaleway-sdk-go/api/vpcgw/v2" +) + +func GetCommands() *core.Commands { + cmds := GetGeneratedCommands() + for _, cmd := range cmds.GetAll() { + if cmd.Verb != "" && !strings.HasSuffix(cmd.Verb, "-v2") { + cmd.Verb = strings.TrimSpace(cmd.Verb) + "-v2" + } + } + + human.RegisterMarshalerFunc(vpcgw.GatewayNetworkStatus(""), human.EnumMarshalFunc(gatewayNetworkStatusMarshalSpecs)) + human.RegisterMarshalerFunc(vpcgw.GatewayStatus(""), human.EnumMarshalFunc(gatewayStatusMarshalSpecs)) + human.RegisterMarshalerFunc(vpcgw.Gateway{}, gatewayMarshalerFunc) + + cmds.MustFind("vpc-gw", "gateway-type", "list").Override(vpcgwGatewayTypeListBuilder) + cmds.MustFind("vpc-gw", "gateway", "create").Override(gatewayCreateBuilder) + cmds.MustFind("vpc-gw", "gateway-network", "create").Override(gatewayNetworkCreateBuilder) + cmds.MustFind("vpc-gw", "gateway-network", "delete").Override(gatewayNetworkDeleteBuilder) + + return cmds +} diff --git a/internal/namespaces/vpcgw/v2/custom_gateway.go b/internal/namespaces/vpcgw/v2/custom_gateway.go new file mode 100644 index 0000000000..09c6eaaf2e --- /dev/null +++ b/internal/namespaces/vpcgw/v2/custom_gateway.go @@ -0,0 +1,65 @@ +package vpcgw + +import ( + "context" + "time" + + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/v2/core" + "github.com/scaleway/scaleway-cli/v2/core/human" + "github.com/scaleway/scaleway-sdk-go/api/vpcgw/v2" + "github.com/scaleway/scaleway-sdk-go/scw" +) + +const ( + gatewayActionTimeout = 60 * time.Minute +) + +var gatewayStatusMarshalSpecs = human.EnumMarshalSpecs{ + vpcgw.GatewayStatusUnknownStatus: &human.EnumMarshalSpec{Attribute: color.Faint}, + vpcgw.GatewayStatusAllocating: &human.EnumMarshalSpec{Attribute: color.FgBlue}, + vpcgw.GatewayStatusConfiguring: &human.EnumMarshalSpec{Attribute: color.FgBlue}, + vpcgw.GatewayStatusDeleting: &human.EnumMarshalSpec{Attribute: color.FgBlue}, + vpcgw.GatewayStatusFailed: &human.EnumMarshalSpec{Attribute: color.FgRed}, + vpcgw.GatewayStatusRunning: &human.EnumMarshalSpec{Attribute: color.FgGreen}, + vpcgw.GatewayStatusStopped: &human.EnumMarshalSpec{Attribute: color.FgRed}, + vpcgw.GatewayStatusLocked: &human.EnumMarshalSpec{Attribute: color.FgRed}, + vpcgw.GatewayStatusStopping: &human.EnumMarshalSpec{Attribute: color.FgBlue}, +} + +func gatewayCreateBuilder(c *core.Command) *core.Command { + c.WaitFunc = func(ctx context.Context, _, respI interface{}) (interface{}, error) { + getResp := respI.(*vpcgw.Gateway) + api := vpcgw.NewAPI(core.ExtractClient(ctx)) + + return api.WaitForGateway(&vpcgw.WaitForGatewayRequest{ + GatewayID: getResp.ID, + Zone: getResp.Zone, + Timeout: scw.TimeDurationPtr(gatewayActionTimeout), + RetryInterval: core.DefaultRetryInterval, + }) + } + + return c +} + +func gatewayMarshalerFunc(i interface{}, opt *human.MarshalOpt) (string, error) { + type tmp vpcgw.Gateway + vpcgtw := tmp(i.(vpcgw.Gateway)) + opt.Sections = []*human.MarshalSection{ + { + FieldName: "IP", + Title: "IP", + }, + { + FieldName: "GatewayNetworks", + Title: "GatewayNetworks", + }, + } + str, err := human.Marshal(vpcgtw, opt) + if err != nil { + return "", err + } + + return str, nil +} diff --git a/internal/namespaces/vpcgw/v2/custom_gateway_network.go b/internal/namespaces/vpcgw/v2/custom_gateway_network.go new file mode 100644 index 0000000000..eca9acd002 --- /dev/null +++ b/internal/namespaces/vpcgw/v2/custom_gateway_network.go @@ -0,0 +1,67 @@ +package vpcgw + +import ( + "context" + "errors" + "net/http" + + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/v2/core" + "github.com/scaleway/scaleway-cli/v2/core/human" + "github.com/scaleway/scaleway-sdk-go/api/vpcgw/v2" + "github.com/scaleway/scaleway-sdk-go/scw" +) + +var gatewayNetworkStatusMarshalSpecs = human.EnumMarshalSpecs{ + vpcgw.GatewayNetworkStatusAttaching: &human.EnumMarshalSpec{Attribute: color.FgBlue}, + vpcgw.GatewayNetworkStatusConfiguring: &human.EnumMarshalSpec{Attribute: color.FgBlue}, + vpcgw.GatewayNetworkStatusCreated: &human.EnumMarshalSpec{Attribute: color.FgGreen}, + vpcgw.GatewayNetworkStatusDetaching: &human.EnumMarshalSpec{Attribute: color.FgBlue}, + vpcgw.GatewayNetworkStatusReady: &human.EnumMarshalSpec{Attribute: color.FgGreen}, + vpcgw.GatewayNetworkStatusUnknownStatus: &human.EnumMarshalSpec{Attribute: color.Faint}, +} + +func gatewayNetworkCreateBuilder(c *core.Command) *core.Command { + c.WaitFunc = func(ctx context.Context, _, respI interface{}) (interface{}, error) { + getResp := respI.(*vpcgw.GatewayNetwork) + api := vpcgw.NewAPI(core.ExtractClient(ctx)) + + return api.WaitForGatewayNetwork(&vpcgw.WaitForGatewayNetworkRequest{ + GatewayNetworkID: getResp.ID, + Zone: getResp.Zone, + Timeout: scw.TimeDurationPtr(gatewayActionTimeout), + RetryInterval: core.DefaultRetryInterval, + }) + } + + return c +} + +func gatewayNetworkDeleteBuilder(c *core.Command) *core.Command { + c.WaitFunc = func(ctx context.Context, argsI, _ interface{}) (interface{}, error) { + getResp := argsI.(*vpcgw.DeleteGatewayNetworkRequest) + api := vpcgw.NewAPI(core.ExtractClient(ctx)) + gwNetwork, err := api.WaitForGatewayNetwork(&vpcgw.WaitForGatewayNetworkRequest{ + GatewayNetworkID: getResp.GatewayNetworkID, + Zone: getResp.Zone, + Timeout: scw.TimeDurationPtr(gatewayActionTimeout), + RetryInterval: core.DefaultRetryInterval, + }) + if err != nil { + notFoundError := &scw.ResourceNotFoundError{} + responseError := &scw.ResponseError{} + if errors.As(err, &responseError) && responseError.StatusCode == http.StatusNotFound || errors.As(err, ¬FoundError) { + return &core.SuccessResult{ + Resource: "gateway-network", + Verb: "delete", + }, nil + } + + return nil, err + } + + return gwNetwork, nil + } + + return c +} diff --git a/internal/namespaces/vpcgw/v2/custom_gateway_type.go b/internal/namespaces/vpcgw/v2/custom_gateway_type.go new file mode 100644 index 0000000000..73533e3fe9 --- /dev/null +++ b/internal/namespaces/vpcgw/v2/custom_gateway_type.go @@ -0,0 +1,23 @@ +package vpcgw + +import ( + "context" + + "github.com/scaleway/scaleway-cli/v2/core" + "github.com/scaleway/scaleway-sdk-go/api/vpcgw/v2" +) + +func vpcgwGatewayTypeListBuilder(c *core.Command) *core.Command { + c.AddInterceptors(func(ctx context.Context, argsI interface{}, runner core.CommandRunner) (interface{}, error) { + res, err := runner(ctx, argsI) + if err != nil { + return nil, err + } + + typesResponse := res.(*vpcgw.ListGatewayTypesResponse) + + return typesResponse.Types, nil + }) + + return c +} diff --git a/scripts/check-size.sh b/scripts/check-size.sh index 8cbc2cbb42..ac0730eeba 100755 --- a/scripts/check-size.sh +++ b/scripts/check-size.sh @@ -1,6 +1,6 @@ #/bin/env bash -MAX_BINARY_SIZE=50000000 +MAX_BINARY_SIZE=52000000 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"