Skip to content

Commit 05199fa

Browse files
authored
feat(ipam): enable commands (#3527)
1 parent fc2e030 commit 05199fa

11 files changed

+304
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Book a new IP from the specified source. Currently IPs can only be booked from a Private Network.
4+
5+
USAGE:
6+
scw ipam ip create [arg=value ...]
7+
8+
ARGS:
9+
[project-id] Project ID to use. If none is passed the default project ID will be used
10+
[source.zonal] Zone the IP lives in if the IP is a public zoned IP.
11+
[source.private-network-id] Private Network the IP lives in if the IP is a private IP.
12+
[source.subnet-id] Private Network subnet the IP lives in if the IP is a private IP in a Private Network.
13+
[is-ipv6] Request an IPv6 instead of an IPv4
14+
[address] Request a specific IP in the requested source pool
15+
[tags.{index}] Tags for the IP
16+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
17+
18+
FLAGS:
19+
-h, --help help for create
20+
21+
GLOBAL FLAGS:
22+
-c, --config string The path to the config file
23+
-D, --debug Enable debug mode
24+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
25+
-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+
Release an IP not currently attached to a resource, and returns it to the available IP pool.
4+
5+
USAGE:
6+
scw ipam ip delete <ip-id ...> [arg=value ...]
7+
8+
ARGS:
9+
ip-id IP 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 IP, specified by its IP ID.
4+
5+
USAGE:
6+
scw ipam ip get <ip-id ...> [arg=value ...]
7+
8+
ARGS:
9+
ip-id IP 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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
List existing IPs in the specified region using various filters. For example, you can filter for IPs within a specified Private Network, or for public IPs within a specified Project. By default, the IPs returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.
4+
5+
USAGE:
6+
scw ipam ip list [arg=value ...]
7+
8+
ARGS:
9+
[order-by] Sort order of the returned IPs (created_at_desc | created_at_asc | updated_at_desc | updated_at_asc | attached_at_desc | attached_at_asc)
10+
[project-id] Project ID to filter for. Only IPs belonging to this Project will be returned
11+
[zonal] Zone to filter for. Only IPs that are zonal, and in this zone, will be returned
12+
[private-network-id] Private Network to filter for
13+
[attached] Defines whether to filter only for IPs which are attached to a resource
14+
[resource-id] Resource ID to filter for. Only IPs attached to this resource will be returned
15+
[resource-type] Resource type to filter for. Only IPs attached to this type of resource will be returned (unknown_type | instance_server | instance_ip | instance_private_nic | lb_server | fip_ip | vpc_gateway | vpc_gateway_network | k8s_node | k8s_cluster | rdb_instance | redis_cluster | baremetal_server | baremetal_private_nic)
16+
[mac-address] MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned
17+
[tags.{index}] Tags to filter for, only IPs with one or more matching tags will be returned
18+
[is-ipv6] Defines whether to filter only for IPv4s or IPv6s
19+
[resource-name] Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned.
20+
[organization-id] Organization ID to filter for. Only IPs belonging to this Organization will be returned
21+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all)
22+
23+
FLAGS:
24+
-h, --help help for list
25+
26+
GLOBAL FLAGS:
27+
-c, --config string The path to the config file
28+
-D, --debug Enable debug mode
29+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
30+
-p, --profile string The config profile to use
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Update parameters including tags of the specified IP.
4+
5+
USAGE:
6+
scw ipam ip update <ip-id ...> [arg=value ...]
7+
8+
ARGS:
9+
ip-id IP ID
10+
[tags.{index}] Tags for the IP
11+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
12+
13+
FLAGS:
14+
-h, --help help for update
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-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+
*ips_long.
4+
5+
USAGE:
6+
scw ipam ip <command>
7+
8+
AVAILABLE COMMANDS:
9+
create Book a new IP
10+
delete Release an IP
11+
get Get an IP
12+
list List existing IPs
13+
update Update an IP
14+
15+
FLAGS:
16+
-h, --help help for ip
17+
18+
GLOBAL FLAGS:
19+
-c, --config string The path to the config file
20+
-D, --debug Enable debug mode
21+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
22+
-p, --profile string The config profile to use
23+
24+
Use "scw ipam ip [command] --help" for more information about a command.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
This API allows you to manage IP addresses with Scaleway's IP Address Management tool.
4+
5+
USAGE:
6+
scw ipam <command>
7+
8+
AVAILABLE COMMANDS:
9+
ip IP management command
10+
11+
FLAGS:
12+
-h, --help help for ipam
13+
14+
GLOBAL FLAGS:
15+
-c, --config string The path to the config file
16+
-D, --debug Enable debug mode
17+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
18+
-p, --profile string The config profile to use
19+
20+
Use "scw ipam [command] --help" for more information about a command.

cmd/scw/testdata/test-main-usage-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ AVAILABLE COMMANDS:
2020
iam IAM API
2121
instance Instance API
2222
iot This API allows you to manage IoT hubs and devices
23+
ipam This API allows you to manage IP addresses with Scaleway's IP Address Management tool
2324
k8s Kubernetes API
2425
lb This API allows you to manage your Scaleway Load Balancer services
2526
marketplace Marketplace API

docs/commands/ipam.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<!-- DO NOT EDIT: this file is automatically generated using scw-doc-gen -->
2+
# Documentation for `scw ipam`
3+
This API allows you to manage IP addresses with Scaleway's IP Address Management tool.
4+
5+
- [IP management command](#ip-management-command)
6+
- [Book a new IP](#book-a-new-ip)
7+
- [Release an IP](#release-an-ip)
8+
- [Get an IP](#get-an-ip)
9+
- [List existing IPs](#list-existing-ips)
10+
- [Update an IP](#update-an-ip)
11+
12+
13+
## IP management command
14+
15+
*ips_long.
16+
17+
18+
### Book a new IP
19+
20+
Book a new IP from the specified source. Currently IPs can only be booked from a Private Network.
21+
22+
**Usage:**
23+
24+
```
25+
scw ipam ip create [arg=value ...]
26+
```
27+
28+
29+
**Args:**
30+
31+
| Name | | Description |
32+
|------|---|-------------|
33+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
34+
| source.zonal | | Zone the IP lives in if the IP is a public zoned IP. |
35+
| source.private-network-id | | Private Network the IP lives in if the IP is a private IP. |
36+
| source.subnet-id | | Private Network subnet the IP lives in if the IP is a private IP in a Private Network. |
37+
| is-ipv6 | | Request an IPv6 instead of an IPv4 |
38+
| address | | Request a specific IP in the requested source pool |
39+
| tags.{index} | | Tags for the IP |
40+
| 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 |
41+
42+
43+
44+
### Release an IP
45+
46+
Release an IP not currently attached to a resource, and returns it to the available IP pool.
47+
48+
**Usage:**
49+
50+
```
51+
scw ipam ip delete <ip-id ...> [arg=value ...]
52+
```
53+
54+
55+
**Args:**
56+
57+
| Name | | Description |
58+
|------|---|-------------|
59+
| ip-id | Required | IP ID |
60+
| 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 |
61+
62+
63+
64+
### Get an IP
65+
66+
Retrieve details of an existing IP, specified by its IP ID.
67+
68+
**Usage:**
69+
70+
```
71+
scw ipam ip get <ip-id ...> [arg=value ...]
72+
```
73+
74+
75+
**Args:**
76+
77+
| Name | | Description |
78+
|------|---|-------------|
79+
| ip-id | Required | IP ID |
80+
| 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 |
81+
82+
83+
84+
### List existing IPs
85+
86+
List existing IPs in the specified region using various filters. For example, you can filter for IPs within a specified Private Network, or for public IPs within a specified Project. By default, the IPs returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.
87+
88+
**Usage:**
89+
90+
```
91+
scw ipam ip list [arg=value ...]
92+
```
93+
94+
95+
**Args:**
96+
97+
| Name | | Description |
98+
|------|---|-------------|
99+
| order-by | One of: `created_at_desc`, `created_at_asc`, `updated_at_desc`, `updated_at_asc`, `attached_at_desc`, `attached_at_asc` | Sort order of the returned IPs |
100+
| project-id | | Project ID to filter for. Only IPs belonging to this Project will be returned |
101+
| zonal | | Zone to filter for. Only IPs that are zonal, and in this zone, will be returned |
102+
| private-network-id | | Private Network to filter for |
103+
| attached | | Defines whether to filter only for IPs which are attached to a resource |
104+
| resource-id | | Resource ID to filter for. Only IPs attached to this resource will be returned |
105+
| resource-type | One of: `unknown_type`, `instance_server`, `instance_ip`, `instance_private_nic`, `lb_server`, `fip_ip`, `vpc_gateway`, `vpc_gateway_network`, `k8s_node`, `k8s_cluster`, `rdb_instance`, `redis_cluster`, `baremetal_server`, `baremetal_private_nic` | Resource type to filter for. Only IPs attached to this type of resource will be returned |
106+
| mac-address | | MAC address to filter for. Only IPs attached to a resource with this MAC address will be returned |
107+
| tags.{index} | | Tags to filter for, only IPs with one or more matching tags will be returned |
108+
| is-ipv6 | | Defines whether to filter only for IPv4s or IPv6s |
109+
| resource-name | | Attached resource name to filter for, only IPs attached to a resource with this string within their name will be returned. |
110+
| organization-id | | Organization ID to filter for. Only IPs belonging to this Organization will be returned |
111+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw`, `all` | Region to target. If none is passed will use default region from the config |
112+
113+
114+
115+
### Update an IP
116+
117+
Update parameters including tags of the specified IP.
118+
119+
**Usage:**
120+
121+
```
122+
scw ipam ip update <ip-id ...> [arg=value ...]
123+
```
124+
125+
126+
**Args:**
127+
128+
| Name | | Description |
129+
|------|---|-------------|
130+
| ip-id | Required | IP ID |
131+
| tags.{index} | | Tags for the IP |
132+
| 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 |
133+
134+
135+

internal/namespaces/get_commands.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
initNamespace "github.com/scaleway/scaleway-cli/v2/internal/namespaces/init"
2424
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/instance/v1"
2525
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/iot/v1"
26+
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/ipam/v1"
2627
ipfs "github.com/scaleway/scaleway-cli/v2/internal/namespaces/ipfs/v1alpha1"
2728
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/k8s/v1"
2829
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/lb/v1"
@@ -88,6 +89,7 @@ func GetCommands() *core.Commands {
8889
documentdb.GetCommands(),
8990
mnq.GetCommands(),
9091
block.GetCommands(),
92+
ipam.GetCommands(),
9193
)
9294

9395
//if beta {}

0 commit comments

Comments
 (0)