Skip to content

Commit 93d86cc

Browse files
scaleway-botyfodil
andauthored
fix(ipam/v1): add missing description (#3821)
Co-authored-by: Yacine Fodil <[email protected]>
1 parent c67e382 commit 93d86cc

File tree

5 files changed

+81
-7
lines changed

5 files changed

+81
-7
lines changed
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 ipam resources.
4+
5+
USAGE:
6+
scw ipam ip-set release [arg=value ...]
7+
8+
ARGS:
9+
[ip-ids.{index}]
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 release
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

cmd/scw/testdata/test-all-usage-ipam-ip-set-usage.golden

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
*ips_long.
4+
35
USAGE:
4-
scw ipam ip-set
6+
scw ipam ip-set <command>
7+
8+
AVAILABLE COMMANDS:
9+
release Release ipam resources
510

611
FLAGS:
712
-h, --help help for ip-set
@@ -11,3 +16,5 @@ GLOBAL FLAGS:
1116
-D, --debug Enable debug mode
1217
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
1318
-p, --profile string The config profile to use
19+
20+
Use "scw ipam ip-set [command] --help" for more information about a command.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ USAGE:
77

88
AVAILABLE COMMANDS:
99
ip IP management command
10-
ip-set
10+
ip-set Management command for sets of IPs
1111

1212
FLAGS:
1313
-h, --help help for ipam

docs/commands/ipam.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ This API allows you to manage your Scaleway IP addresses with our IP Address Man
88
- [Get an IP](#get-an-ip)
99
- [List existing IPs](#list-existing-ips)
1010
- [Update an IP](#update-an-ip)
11-
- [](#)
11+
- [Management command for sets of IPs](#management-command-for-sets-of-ips)
12+
- [Release ipam resources](#release-ipam-resources)
1213

1314

1415
## IP management command
@@ -138,17 +139,28 @@ scw ipam ip update <ip-id ...> [arg=value ...]
138139

139140

140141

141-
##
142+
## Management command for sets of IPs
142143

144+
*ips_long.
143145

144146

147+
### Release ipam resources
145148

149+
Release ipam resources.
146150

147151
**Usage:**
148152

149153
```
150-
scw ipam ip-set
154+
scw ipam ip-set release [arg=value ...]
151155
```
152156

153157

158+
**Args:**
159+
160+
| Name | | Description |
161+
|------|---|-------------|
162+
| ip-ids.{index} | | |
163+
| 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 |
164+
165+
154166

internal/namespaces/ipam/v1/ipam_cli.go

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func GetGeneratedCommands() *core.Commands {
2424
ipamIPSet(),
2525
ipamIPCreate(),
2626
ipamIPDelete(),
27+
ipamIPSetRelease(),
2728
ipamIPGet(),
2829
ipamIPUpdate(),
2930
ipamIPList(),
@@ -48,8 +49,8 @@ func ipamIP() *core.Command {
4849

4950
func ipamIPSet() *core.Command {
5051
return &core.Command{
51-
Short: ``,
52-
Long: ``,
52+
Short: `Management command for sets of IPs`,
53+
Long: `*ips_long.`,
5354
Namespace: "ipam",
5455
Resource: "ip-set",
5556
}
@@ -157,6 +158,41 @@ func ipamIPDelete() *core.Command {
157158
}
158159
}
159160

161+
func ipamIPSetRelease() *core.Command {
162+
return &core.Command{
163+
Short: `Release ipam resources`,
164+
Long: `Release ipam resources.`,
165+
Namespace: "ipam",
166+
Resource: "ip-set",
167+
Verb: "release",
168+
// Deprecated: false,
169+
ArgsType: reflect.TypeOf(ipam.ReleaseIPSetRequest{}),
170+
ArgSpecs: core.ArgSpecs{
171+
{
172+
Name: "ip-ids.{index}",
173+
Required: false,
174+
Deprecated: false,
175+
Positional: false,
176+
},
177+
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
178+
},
179+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
180+
request := args.(*ipam.ReleaseIPSetRequest)
181+
182+
client := core.ExtractClient(ctx)
183+
api := ipam.NewAPI(client)
184+
e = api.ReleaseIPSet(request)
185+
if e != nil {
186+
return nil, e
187+
}
188+
return &core.SuccessResult{
189+
Resource: "ip-set",
190+
Verb: "release",
191+
}, nil
192+
},
193+
}
194+
}
195+
160196
func ipamIPGet() *core.Command {
161197
return &core.Command{
162198
Short: `Get an IP`,

0 commit comments

Comments
 (0)