Skip to content

Commit

Permalink
feat(vpc): enable route cli generation (#4128)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Sep 16, 2024
1 parent 57298fc commit 5b1f5ad
Show file tree
Hide file tree
Showing 11 changed files with 415 additions and 21 deletions.
24 changes: 24 additions & 0 deletions cmd/scw/testdata/test-all-usage-vpc-route-create-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Create a new custom Route.

USAGE:
scw vpc route create [arg=value ...]

ARGS:
[description] Route description
[tags.{index}] Tags of the Route
[vpc-id] VPC the Route belongs to
[destination] Destination of the Route
[nexthop-resource-id] ID of the nexthop resource
[nexthop-private-network-id] ID of the nexthop private network
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

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
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-vpc-route-delete-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Delete a Route specified by its Route ID.

USAGE:
scw vpc route delete <route-id ...> [arg=value ...]

ARGS:
route-id Route ID
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

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
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-vpc-route-get-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve details of an existing Route, specified by its Route ID.

USAGE:
scw vpc route get <route-id ...> [arg=value ...]

ARGS:
route-id Route ID
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

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
26 changes: 26 additions & 0 deletions cmd/scw/testdata/test-all-usage-vpc-route-list-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Return routes with associated next hop data.

USAGE:
scw vpc route list [arg=value ...]

ARGS:
[order-by] Sort order of the returned routes (created_at_asc | created_at_desc | destination_asc | destination_desc | prefix_len_asc | prefix_len_desc)
[vpc-id] VPC to filter for. Only routes within this VPC will be returned
[nexthop-resource-id] Next hop resource ID to filter for. Only routes with a matching next hop resource ID will be returned
[nexthop-private-network-id] Next hop private network ID to filter for. Only routes with a matching next hop private network ID will be returned
[nexthop-resource-type] Next hop resource type to filter for. Only Routes with a matching next hop resource type will be returned (unknown_type | vpc_gateway_network | instance_private_nic | baremetal_private_nic)
[contains] Only routes whose destination is contained in this subnet will be returned
[tags.{index}] Tags to filter for, only routes with one or more matching tags will be returned
[is-ipv6] Only routes with an IPv6 destination will be returned
[region=fr-par] Region to target. If none is passed will use default region from the config (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
24 changes: 24 additions & 0 deletions cmd/scw/testdata/test-all-usage-vpc-route-update-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update parameters of the specified Route.

USAGE:
scw vpc route update <route-id ...> [arg=value ...]

ARGS:
route-id Route ID
[description] Route description
[tags.{index}] Tags of the Route
[destination] Destination of the Route
[nexthop-resource-id] ID of the nexthop resource
[nexthop-private-network-id] ID of the nexthop private network
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)

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
5 changes: 5 additions & 0 deletions cmd/scw/testdata/test-all-usage-vpc-route-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ USAGE:
scw vpc route <command>

AVAILABLE COMMANDS:
create Create a Route
delete Delete a Route
enable-routing Enable routing on a VPC
get Get a Route
list Return routes with associated next hop data
update Update Route

FLAGS:
-h, --help help for route
Expand Down
1 change: 0 additions & 1 deletion cmd/scw/testdata/test-all-usage-vpc-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ USAGE:
AVAILABLE COMMANDS:
private-network Private network management command
route Route management command
routes Routes management command
subnet Subnet management command
vpc VPC management command

Expand Down
96 changes: 92 additions & 4 deletions docs/commands/vpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ This API allows you to manage your Virtual Private Clouds (VPCs) and Private Net
- [Migrate Private Networks from zoned to regional](#migrate-private-networks-from-zoned-to-regional)
- [Update Private Network](#update-private-network)
- [Route management command](#route-management-command)
- [Create a Route](#create-a-route)
- [Delete a Route](#delete-a-route)
- [Enable routing on a VPC](#enable-routing-on-a-vpc)
- [Routes management command](#routes-management-command)
- [Get a Route](#get-a-route)
- [Return routes with associated next hop data](#return-routes-with-associated-next-hop-data)
- [Update Route](#update-route)
- [Subnet management command](#subnet-management-command)
- [VPC management command](#vpc-management-command)
- [Create a VPC](#create-a-vpc)
Expand Down Expand Up @@ -191,6 +194,51 @@ scw vpc private-network update <private-network-id ...> [arg=value ...]
Custom routes.


### Create a Route

Create a new custom Route.

**Usage:**

```
scw vpc route create [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| description | | Route description |
| tags.{index} | | Tags of the Route |
| vpc-id | | VPC the Route belongs to |
| destination | | Destination of the Route |
| nexthop-resource-id | | ID of the nexthop resource |
| nexthop-private-network-id | | ID of the nexthop private network |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



### Delete a Route

Delete a Route specified by its Route ID.

**Usage:**

```
scw vpc route delete <route-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| route-id | Required | Route ID |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



### Enable routing on a VPC

Enable routing on an existing VPC. Note that you will not be able to deactivate it afterwards.
Expand All @@ -211,9 +259,24 @@ scw vpc route enable-routing <vpc-id ...> [arg=value ...]



## Routes management command
### Get a Route

Retrieve details of an existing Route, specified by its Route ID.

**Usage:**

```
scw vpc route get <route-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| route-id | Required | Route ID |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |

Routes management command.


### Return routes with associated next hop data
Expand All @@ -223,7 +286,7 @@ Return routes with associated next hop data.
**Usage:**

```
scw vpc routes list [arg=value ...]
scw vpc route list [arg=value ...]
```


Expand All @@ -243,6 +306,31 @@ scw vpc routes list [arg=value ...]



### Update Route

Update parameters of the specified Route.

**Usage:**

```
scw vpc route update <route-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| route-id | Required | Route ID |
| description | | Route description |
| tags.{index} | | Tags of the Route |
| destination | | Destination of the Route |
| nexthop-resource-id | | ID of the nexthop resource |
| nexthop-private-network-id | | ID of the nexthop private network |
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |



## Subnet management command

CIDR Subnet.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/moby/buildkit v0.13.2
github.com/opencontainers/go-digest v1.0.0
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240910124414-bec257c2bbc7
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240912155428-d319ae16fc2a
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240910124414-bec257c2bbc7 h1:CFtaqYB/yhupu2aNrTo6uU83VgDKQbxyjBAYBvqfJr4=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240910124414-bec257c2bbc7/go.mod h1:o/2twhmcz4HlhtuuubCuwQ/fe+zyzoJR85+02gy04yY=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240912155428-d319ae16fc2a h1:rDcrJhNF+Fh3wkXQD/Bre5XhzO4rVZrCLsMTapWE8p0=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240912155428-d319ae16fc2a/go.mod h1:o/2twhmcz4HlhtuuubCuwQ/fe+zyzoJR85+02gy04yY=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=
Expand Down
Loading

0 comments on commit 5b1f5ad

Please sign in to comment.