Skip to content

Commit 5b1f5ad

Browse files
authored
feat(vpc): enable route cli generation (#4128)
1 parent 57298fc commit 5b1f5ad

11 files changed

+415
-21
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Create a new custom Route.
4+
5+
USAGE:
6+
scw vpc route create [arg=value ...]
7+
8+
ARGS:
9+
[description] Route description
10+
[tags.{index}] Tags of the Route
11+
[vpc-id] VPC the Route belongs to
12+
[destination] Destination of the Route
13+
[nexthop-resource-id] ID of the nexthop resource
14+
[nexthop-private-network-id] ID of the nexthop private network
15+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
16+
17+
FLAGS:
18+
-h, --help help for create
19+
20+
GLOBAL FLAGS:
21+
-c, --config string The path to the config file
22+
-D, --debug Enable debug mode
23+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
24+
-p, --profile string The config profile to use
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Delete a Route specified by its Route ID.
4+
5+
USAGE:
6+
scw vpc route delete <route-id ...> [arg=value ...]
7+
8+
ARGS:
9+
route-id Route ID
10+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
11+
12+
FLAGS:
13+
-h, --help help for delete
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Retrieve details of an existing Route, specified by its Route ID.
4+
5+
USAGE:
6+
scw vpc route get <route-id ...> [arg=value ...]
7+
8+
ARGS:
9+
route-id Route ID
10+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
11+
12+
FLAGS:
13+
-h, --help help for get
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Return routes with associated next hop data.
4+
5+
USAGE:
6+
scw vpc route list [arg=value ...]
7+
8+
ARGS:
9+
[order-by] Sort order of the returned routes (created_at_asc | created_at_desc | destination_asc | destination_desc | prefix_len_asc | prefix_len_desc)
10+
[vpc-id] VPC to filter for. Only routes within this VPC will be returned
11+
[nexthop-resource-id] Next hop resource ID to filter for. Only routes with a matching next hop resource ID will be returned
12+
[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
13+
[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)
14+
[contains] Only routes whose destination is contained in this subnet will be returned
15+
[tags.{index}] Tags to filter for, only routes with one or more matching tags will be returned
16+
[is-ipv6] Only routes with an IPv6 destination will be returned
17+
[region=fr-par] Region to target. If none is passed will use default region from the config (all)
18+
19+
FLAGS:
20+
-h, --help help for list
21+
22+
GLOBAL FLAGS:
23+
-c, --config string The path to the config file
24+
-D, --debug Enable debug mode
25+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
26+
-p, --profile string The config profile to use
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Update parameters of the specified Route.
4+
5+
USAGE:
6+
scw vpc route update <route-id ...> [arg=value ...]
7+
8+
ARGS:
9+
route-id Route ID
10+
[description] Route description
11+
[tags.{index}] Tags of the Route
12+
[destination] Destination of the Route
13+
[nexthop-resource-id] ID of the nexthop resource
14+
[nexthop-private-network-id] ID of the nexthop private network
15+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
16+
17+
FLAGS:
18+
-h, --help help for update
19+
20+
GLOBAL FLAGS:
21+
-c, --config string The path to the config file
22+
-D, --debug Enable debug mode
23+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
24+
-p, --profile string The config profile to use

cmd/scw/testdata/test-all-usage-vpc-route-usage.golden

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ USAGE:
66
scw vpc route <command>
77

88
AVAILABLE COMMANDS:
9+
create Create a Route
10+
delete Delete a Route
911
enable-routing Enable routing on a VPC
12+
get Get a Route
13+
list Return routes with associated next hop data
14+
update Update Route
1015

1116
FLAGS:
1217
-h, --help help for route

cmd/scw/testdata/test-all-usage-vpc-usage.golden

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ USAGE:
88
AVAILABLE COMMANDS:
99
private-network Private network management command
1010
route Route management command
11-
routes Routes management command
1211
subnet Subnet management command
1312
vpc VPC management command
1413

docs/commands/vpc.md

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ This API allows you to manage your Virtual Private Clouds (VPCs) and Private Net
1111
- [Migrate Private Networks from zoned to regional](#migrate-private-networks-from-zoned-to-regional)
1212
- [Update Private Network](#update-private-network)
1313
- [Route management command](#route-management-command)
14+
- [Create a Route](#create-a-route)
15+
- [Delete a Route](#delete-a-route)
1416
- [Enable routing on a VPC](#enable-routing-on-a-vpc)
15-
- [Routes management command](#routes-management-command)
17+
- [Get a Route](#get-a-route)
1618
- [Return routes with associated next hop data](#return-routes-with-associated-next-hop-data)
19+
- [Update Route](#update-route)
1720
- [Subnet management command](#subnet-management-command)
1821
- [VPC management command](#vpc-management-command)
1922
- [Create a VPC](#create-a-vpc)
@@ -191,6 +194,51 @@ scw vpc private-network update <private-network-id ...> [arg=value ...]
191194
Custom routes.
192195

193196

197+
### Create a Route
198+
199+
Create a new custom Route.
200+
201+
**Usage:**
202+
203+
```
204+
scw vpc route create [arg=value ...]
205+
```
206+
207+
208+
**Args:**
209+
210+
| Name | | Description |
211+
|------|---|-------------|
212+
| description | | Route description |
213+
| tags.{index} | | Tags of the Route |
214+
| vpc-id | | VPC the Route belongs to |
215+
| destination | | Destination of the Route |
216+
| nexthop-resource-id | | ID of the nexthop resource |
217+
| nexthop-private-network-id | | ID of the nexthop private network |
218+
| 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 |
219+
220+
221+
222+
### Delete a Route
223+
224+
Delete a Route specified by its Route ID.
225+
226+
**Usage:**
227+
228+
```
229+
scw vpc route delete <route-id ...> [arg=value ...]
230+
```
231+
232+
233+
**Args:**
234+
235+
| Name | | Description |
236+
|------|---|-------------|
237+
| route-id | Required | Route ID |
238+
| 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 |
239+
240+
241+
194242
### Enable routing on a VPC
195243

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

212260

213261

214-
## Routes management command
262+
### Get a Route
263+
264+
Retrieve details of an existing Route, specified by its Route ID.
265+
266+
**Usage:**
267+
268+
```
269+
scw vpc route get <route-id ...> [arg=value ...]
270+
```
271+
272+
273+
**Args:**
274+
275+
| Name | | Description |
276+
|------|---|-------------|
277+
| route-id | Required | Route ID |
278+
| 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 |
215279

216-
Routes management command.
217280

218281

219282
### Return routes with associated next hop data
@@ -223,7 +286,7 @@ Return routes with associated next hop data.
223286
**Usage:**
224287

225288
```
226-
scw vpc routes list [arg=value ...]
289+
scw vpc route list [arg=value ...]
227290
```
228291

229292

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

244307

245308

309+
### Update Route
310+
311+
Update parameters of the specified Route.
312+
313+
**Usage:**
314+
315+
```
316+
scw vpc route update <route-id ...> [arg=value ...]
317+
```
318+
319+
320+
**Args:**
321+
322+
| Name | | Description |
323+
|------|---|-------------|
324+
| route-id | Required | Route ID |
325+
| description | | Route description |
326+
| tags.{index} | | Tags of the Route |
327+
| destination | | Destination of the Route |
328+
| nexthop-resource-id | | ID of the nexthop resource |
329+
| nexthop-private-network-id | | ID of the nexthop private network |
330+
| 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 |
331+
332+
333+
246334
## Subnet management command
247335

248336
CIDR Subnet.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/mattn/go-isatty v0.0.20
2727
github.com/moby/buildkit v0.13.2
2828
github.com/opencontainers/go-digest v1.0.0
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240910124414-bec257c2bbc7
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240912155428-d319ae16fc2a
3030
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3131
github.com/spf13/cobra v1.8.1
3232
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
465465
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
466466
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
467467
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
468-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240910124414-bec257c2bbc7 h1:CFtaqYB/yhupu2aNrTo6uU83VgDKQbxyjBAYBvqfJr4=
469-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240910124414-bec257c2bbc7/go.mod h1:o/2twhmcz4HlhtuuubCuwQ/fe+zyzoJR85+02gy04yY=
468+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240912155428-d319ae16fc2a h1:rDcrJhNF+Fh3wkXQD/Bre5XhzO4rVZrCLsMTapWE8p0=
469+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20240912155428-d319ae16fc2a/go.mod h1:o/2twhmcz4HlhtuuubCuwQ/fe+zyzoJR85+02gy04yY=
470470
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
471471
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
472472
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

0 commit comments

Comments
 (0)