Skip to content

Commit 91f84a8

Browse files
committed
feat(cli): add cloud network security-group + migrate gateway to API v2
Signed-off-by: olivier dubo <olivier.dubo@ovhcloud.com>
1 parent f9520c1 commit 91f84a8

21 files changed

Lines changed: 4021 additions & 1332 deletions

doc/ovhcloud_cloud_network.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ Manage networks in the given cloud project
3434
* [ovhcloud cloud network gateway](ovhcloud_cloud_network_gateway.md) - Manage gateways in the given cloud project
3535
* [ovhcloud cloud network private](ovhcloud_cloud_network_private.md) - Manage private networks in the given cloud project
3636
* [ovhcloud cloud network public](ovhcloud_cloud_network_public.md) - Manage public networks in the given cloud project
37+
* [ovhcloud cloud network security-group](ovhcloud_cloud_network_security-group.md) - Manage security groups in the given cloud project
3738

doc/ovhcloud_cloud_network_gateway_create.md

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,82 +4,59 @@ Create a gateway in the given cloud project
44

55
### Synopsis
66

7-
Use this command to create a new gateway.
7+
Use this command to create a new gateway in the given public cloud project.
88

9-
Two options are available to create a gateway:
10-
- Create a gateway in an existing private network
11-
- Create a gateway in a new private network
12-
13-
When creating a gateway in an existing private network, you must specify the network ID and subnet ID
14-
using the flags --network-id and --subnet-id.
15-
In this case, only two parameters are supported and required: the gateway model and its name (respectively
16-
--model and --name flags).
17-
18-
There are three ways to define the parameters:
9+
Subnets are nested objects: to attach them, use the repeatable --subnet flag, a
10+
configuration file or your text editor. There are three ways to define the
11+
creation parameters:
1912

2013
1. Using only CLI flags:
2114

22-
ovhcloud cloud network gateway create <region> --name MyGateway --model xl
15+
ovhcloud cloud network gateway create --name MyGateway --region GRA11 --external-gateway-enabled --external-gateway-model S
2316

2417
2. Using a configuration file:
2518

2619
First you can generate an example of parameters file using the following command:
2720

28-
ovhcloud cloud network gateway create <region> --init-file ./params.json
21+
ovhcloud cloud network gateway create --init-file ./params.json
2922

30-
You will be able to choose from several examples of parameters. Once an example has been selected, the content is written in the given file.
3123
After editing the file to set the correct creation parameters, run:
3224

33-
ovhcloud cloud network gateway create <region> --from-file ./params.json
25+
ovhcloud cloud network gateway create --from-file ./params.json
3426

3527
Note that you can also pipe the content of the parameters file, like the following:
3628

37-
cat ./params.json | ovhcloud cloud network gateway create <region>
29+
cat ./params.json | ovhcloud cloud network gateway create
3830

3931
In both cases, you can override the parameters in the given file using command line flags, for example:
4032

41-
ovhcloud cloud network gateway create <region> --from-file ./params.json --name MyGateway
33+
ovhcloud cloud network gateway create --from-file ./params.json --name MyGateway
4234

4335
3. Using your default text editor:
4436

45-
ovhcloud cloud network gateway create <region> --editor
46-
47-
You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your
48-
default text editor to update the parameters. When saving the file, the creation will start.
49-
50-
Note that it is also possible to override values in the presented examples using command line flags like the following:
51-
52-
ovhcloud cloud network gateway create <region> --editor --name MyGateway
37+
ovhcloud cloud network gateway create --editor
5338

5439

5540
```
56-
ovhcloud cloud network gateway create <region> [flags]
41+
ovhcloud cloud network gateway create [flags]
5742
```
5843

5944
### Options
6045

6146
```
62-
--editor Use a text editor to define parameters
63-
--from-file string File containing parameters
64-
-h, --help help for create
65-
--init-file string Create a file with example parameters
66-
--model string Gateway model (s, m, l, xl, 2xl, 3xl)
67-
--name string Name of the gateway
68-
--network-id string ID of the existing private network to create the gateway in
69-
--network-name string Name of the private network
70-
--network-vlan-id int VLAN ID for the private network
71-
--replace Replace parameters file if it already exists
72-
--subnet-allocation-pools strings Allocation pools for the subnet in format start:end
73-
--subnet-cidr string CIDR of the subnet
74-
--subnet-dns-name-servers strings DNS name servers for the subnet
75-
--subnet-enable-dhcp Enable DHCP for the subnet
76-
--subnet-gateway-ip string Gateway IP address for the subnet
77-
--subnet-host-routes strings Host routes for the subnet in format destination:nextHop
78-
--subnet-id string ID of the existing subnet to create the gateway in
79-
--subnet-ip-version int IP version (4 or 6)
80-
--subnet-name string Name of the subnet
81-
--subnet-use-default-public-dns-resolver Use default DNS resolver for the subnet
82-
--wait Wait for gateway creation to be done before exiting
47+
--availability-zone string Availability zone within the region
48+
--description string Description of the gateway
49+
--editor Use a text editor to define parameters
50+
--external-gateway-enabled Whether the external gateway is enabled
51+
--external-gateway-model string External gateway sizing model (S, M, L, XL, 2XL, 3XL)
52+
--from-file string File containing parameters
53+
-h, --help help for create
54+
--init-file string Create a file with example parameters
55+
--name string Name of the gateway
56+
--region string Region where the gateway will be created
57+
--replace Replace parameters file if it already exists
58+
--subnet strings ID of a subnet to attach to the gateway (repeatable)
59+
--wait Wait for gateway creation to be done before exiting
8360
```
8461

8562
### Options inherited from parent commands

doc/ovhcloud_cloud_network_gateway_edit.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ ovhcloud cloud network gateway edit <gateway_id> [flags]
99
### Options
1010

1111
```
12-
--editor Use a text editor to define parameters
13-
-h, --help help for edit
14-
--model string Model of the gateway (s, m, l, xl, 2xl, 3xl)
15-
--name string Name of the gateway
12+
--description string Description of the gateway
13+
--editor Use a text editor to define parameters
14+
--external-gateway-enabled Whether the external gateway is enabled
15+
--external-gateway-model string External gateway sizing model (S, M, L, XL, 2XL, 3XL)
16+
-h, --help help for edit
17+
--name string Name of the gateway
18+
--subnet strings ID of a subnet to attach to the gateway (repeatable)
1619
```
1720

1821
### Options inherited from parent commands
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## ovhcloud cloud network security-group
2+
3+
Manage security groups in the given cloud project
4+
5+
### Options
6+
7+
```
8+
-h, --help help for security-group
9+
```
10+
11+
### Options inherited from parent commands
12+
13+
```
14+
--cloud-project string Cloud project ID
15+
-d, --debug Activate debug mode (will log all HTTP requests details)
16+
-e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution
17+
-o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax)
18+
Examples:
19+
--output json
20+
--output yaml
21+
--output interactive
22+
--output 'id' (to extract a single field)
23+
--output 'nested.field.subfield' (to extract a nested field)
24+
--output '[id, "name"]' (to extract multiple fields as an array)
25+
--output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object)
26+
--output 'name+","+type' (to extract and concatenate fields in a string)
27+
--output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields)
28+
--profile string Use a specific profile from the configuration file
29+
```
30+
31+
### SEE ALSO
32+
33+
* [ovhcloud cloud network](ovhcloud_cloud_network.md) - Manage networks in the given cloud project
34+
* [ovhcloud cloud network security-group create](ovhcloud_cloud_network_security-group_create.md) - Create a new security group
35+
* [ovhcloud cloud network security-group delete](ovhcloud_cloud_network_security-group_delete.md) - Delete a specific security group
36+
* [ovhcloud cloud network security-group edit](ovhcloud_cloud_network_security-group_edit.md) - Edit the given security group
37+
* [ovhcloud cloud network security-group get](ovhcloud_cloud_network_security-group_get.md) - Get a specific security group
38+
* [ovhcloud cloud network security-group list](ovhcloud_cloud_network_security-group_list.md) - List security groups
39+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
## ovhcloud cloud network security-group create
2+
3+
Create a new security group
4+
5+
### Synopsis
6+
7+
Use this command to create a security group in the given public cloud project.
8+
9+
Rules are nested objects: to define them, use a configuration file or your text
10+
editor. There are three ways to define the creation parameters:
11+
12+
1. Using only CLI flags:
13+
14+
ovhcloud cloud network security-group create --name my-sg --region GRA11
15+
16+
2. Using a configuration file:
17+
18+
First you can generate an example of parameters file using the following command:
19+
20+
ovhcloud cloud network security-group create --init-file ./params.json
21+
22+
After editing the file to set the correct creation parameters, run:
23+
24+
ovhcloud cloud network security-group create --from-file ./params.json
25+
26+
You can also pipe the content of the parameters file:
27+
28+
cat ./params.json | ovhcloud cloud network security-group create
29+
30+
In both cases, you can override values using command line flags, for example:
31+
32+
ovhcloud cloud network security-group create --from-file ./params.json --name my-sg
33+
34+
3. Using your default text editor:
35+
36+
ovhcloud cloud network security-group create --editor
37+
38+
39+
```
40+
ovhcloud cloud network security-group create [flags]
41+
```
42+
43+
### Options
44+
45+
```
46+
--availability-zone string Availability zone within the region
47+
--description string Description of the security group
48+
--editor Use a text editor to define parameters
49+
--from-file string File containing parameters
50+
-h, --help help for create
51+
--init-file string Create a file with example parameters
52+
--name string Name of the security group
53+
--region string Region where the security group will be created
54+
--replace Replace parameters file if it already exists
55+
--wait Wait for security group creation to be done before exiting
56+
```
57+
58+
### Options inherited from parent commands
59+
60+
```
61+
--cloud-project string Cloud project ID
62+
-d, --debug Activate debug mode (will log all HTTP requests details)
63+
-e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution
64+
-o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax)
65+
Examples:
66+
--output json
67+
--output yaml
68+
--output interactive
69+
--output 'id' (to extract a single field)
70+
--output 'nested.field.subfield' (to extract a nested field)
71+
--output '[id, "name"]' (to extract multiple fields as an array)
72+
--output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object)
73+
--output 'name+","+type' (to extract and concatenate fields in a string)
74+
--output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields)
75+
--profile string Use a specific profile from the configuration file
76+
```
77+
78+
### SEE ALSO
79+
80+
* [ovhcloud cloud network security-group](ovhcloud_cloud_network_security-group.md) - Manage security groups in the given cloud project
81+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## ovhcloud cloud network security-group delete
2+
3+
Delete a specific security group
4+
5+
```
6+
ovhcloud cloud network security-group delete <security_group_id> [flags]
7+
```
8+
9+
### Options
10+
11+
```
12+
-h, --help help for delete
13+
```
14+
15+
### Options inherited from parent commands
16+
17+
```
18+
--cloud-project string Cloud project ID
19+
-d, --debug Activate debug mode (will log all HTTP requests details)
20+
-e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution
21+
-o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax)
22+
Examples:
23+
--output json
24+
--output yaml
25+
--output interactive
26+
--output 'id' (to extract a single field)
27+
--output 'nested.field.subfield' (to extract a nested field)
28+
--output '[id, "name"]' (to extract multiple fields as an array)
29+
--output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object)
30+
--output 'name+","+type' (to extract and concatenate fields in a string)
31+
--output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields)
32+
--profile string Use a specific profile from the configuration file
33+
```
34+
35+
### SEE ALSO
36+
37+
* [ovhcloud cloud network security-group](ovhcloud_cloud_network_security-group.md) - Manage security groups in the given cloud project
38+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## ovhcloud cloud network security-group edit
2+
3+
Edit the given security group
4+
5+
```
6+
ovhcloud cloud network security-group edit <security_group_id> [flags]
7+
```
8+
9+
### Options
10+
11+
```
12+
--description string Description of the security group
13+
--editor Use a text editor to define parameters
14+
-h, --help help for edit
15+
--name string Name of the security group
16+
```
17+
18+
### Options inherited from parent commands
19+
20+
```
21+
--cloud-project string Cloud project ID
22+
-d, --debug Activate debug mode (will log all HTTP requests details)
23+
-e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution
24+
-o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax)
25+
Examples:
26+
--output json
27+
--output yaml
28+
--output interactive
29+
--output 'id' (to extract a single field)
30+
--output 'nested.field.subfield' (to extract a nested field)
31+
--output '[id, "name"]' (to extract multiple fields as an array)
32+
--output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object)
33+
--output 'name+","+type' (to extract and concatenate fields in a string)
34+
--output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields)
35+
--profile string Use a specific profile from the configuration file
36+
```
37+
38+
### SEE ALSO
39+
40+
* [ovhcloud cloud network security-group](ovhcloud_cloud_network_security-group.md) - Manage security groups in the given cloud project
41+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## ovhcloud cloud network security-group get
2+
3+
Get a specific security group
4+
5+
```
6+
ovhcloud cloud network security-group get <security_group_id> [flags]
7+
```
8+
9+
### Options
10+
11+
```
12+
-h, --help help for get
13+
```
14+
15+
### Options inherited from parent commands
16+
17+
```
18+
--cloud-project string Cloud project ID
19+
-d, --debug Activate debug mode (will log all HTTP requests details)
20+
-e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution
21+
-o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax)
22+
Examples:
23+
--output json
24+
--output yaml
25+
--output interactive
26+
--output 'id' (to extract a single field)
27+
--output 'nested.field.subfield' (to extract a nested field)
28+
--output '[id, "name"]' (to extract multiple fields as an array)
29+
--output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object)
30+
--output 'name+","+type' (to extract and concatenate fields in a string)
31+
--output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields)
32+
--profile string Use a specific profile from the configuration file
33+
```
34+
35+
### SEE ALSO
36+
37+
* [ovhcloud cloud network security-group](ovhcloud_cloud_network_security-group.md) - Manage security groups in the given cloud project
38+

0 commit comments

Comments
 (0)