Skip to content

Commit

Permalink
fix(ipam/v1): add missing description (#3821)
Browse files Browse the repository at this point in the history
Co-authored-by: Yacine Fodil <[email protected]>
  • Loading branch information
scaleway-bot and yfodil authored May 20, 2024
1 parent c67e382 commit 93d86cc
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 7 deletions.
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-ipam-ip-set-release-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Release ipam resources.

USAGE:
scw ipam ip-set release [arg=value ...]

ARGS:
[ip-ids.{index}]
[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 release

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
9 changes: 8 additions & 1 deletion cmd/scw/testdata/test-all-usage-ipam-ip-set-usage.golden
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
*ips_long.

USAGE:
scw ipam ip-set
scw ipam ip-set <command>

AVAILABLE COMMANDS:
release Release ipam resources

FLAGS:
-h, --help help for ip-set
Expand All @@ -11,3 +16,5 @@ GLOBAL FLAGS:
-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

Use "scw ipam ip-set [command] --help" for more information about a command.
2 changes: 1 addition & 1 deletion cmd/scw/testdata/test-all-usage-ipam-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ USAGE:

AVAILABLE COMMANDS:
ip IP management command
ip-set
ip-set Management command for sets of IPs

FLAGS:
-h, --help help for ipam
Expand Down
18 changes: 15 additions & 3 deletions docs/commands/ipam.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ This API allows you to manage your Scaleway IP addresses with our IP Address Man
- [Get an IP](#get-an-ip)
- [List existing IPs](#list-existing-ips)
- [Update an IP](#update-an-ip)
- [](#)
- [Management command for sets of IPs](#management-command-for-sets-of-ips)
- [Release ipam resources](#release-ipam-resources)


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



##
## Management command for sets of IPs

*ips_long.


### Release ipam resources

Release ipam resources.

**Usage:**

```
scw ipam ip-set
scw ipam ip-set release [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| ip-ids.{index} | | |
| 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 |



40 changes: 38 additions & 2 deletions internal/namespaces/ipam/v1/ipam_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func GetGeneratedCommands() *core.Commands {
ipamIPSet(),
ipamIPCreate(),
ipamIPDelete(),
ipamIPSetRelease(),
ipamIPGet(),
ipamIPUpdate(),
ipamIPList(),
Expand All @@ -48,8 +49,8 @@ func ipamIP() *core.Command {

func ipamIPSet() *core.Command {
return &core.Command{
Short: ``,
Long: ``,
Short: `Management command for sets of IPs`,
Long: `*ips_long.`,
Namespace: "ipam",
Resource: "ip-set",
}
Expand Down Expand Up @@ -157,6 +158,41 @@ func ipamIPDelete() *core.Command {
}
}

func ipamIPSetRelease() *core.Command {
return &core.Command{
Short: `Release ipam resources`,
Long: `Release ipam resources.`,
Namespace: "ipam",
Resource: "ip-set",
Verb: "release",
// Deprecated: false,
ArgsType: reflect.TypeOf(ipam.ReleaseIPSetRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "ip-ids.{index}",
Required: false,
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*ipam.ReleaseIPSetRequest)

client := core.ExtractClient(ctx)
api := ipam.NewAPI(client)
e = api.ReleaseIPSet(request)
if e != nil {
return nil, e
}
return &core.SuccessResult{
Resource: "ip-set",
Verb: "release",
}, nil
},
}
}

func ipamIPGet() *core.Command {
return &core.Command{
Short: `Get an IP`,
Expand Down

0 comments on commit 93d86cc

Please sign in to comment.