Skip to content

Commit 234035d

Browse files
scaleway-botyfodil
andauthored
feat(vpc_gw): document call MigrateToV2 (#4572)
Co-authored-by: Yacine Fodil <105779815+yfodil@users.noreply.github.com>
1 parent a4eb6fd commit 234035d

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
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+
Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent.
4+
5+
USAGE:
6+
scw vpc-gw gateway migrate-to-v2 <gateway-id ...> [arg=value ...]
7+
8+
ARGS:
9+
gateway-id ID of the gateway to put into IPAM mode
10+
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1 | nl-ams-2 | nl-ams-3 | pl-waw-1 | pl-waw-2 | pl-waw-3)
11+
12+
FLAGS:
13+
-h, --help help for migrate-to-v2
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-vpc-gw-gateway-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AVAILABLE COMMANDS:
1111
enable-ip-mobility Upgrade a Public Gateway to IP mobility
1212
get Get a Public Gateway
1313
list List Public Gateways
14+
migrate-to-v2 Put a Public Gateway in IPAM mode
1415
refresh-ssh-keys Refresh a Public Gateway's SSH keys
1516
update Update a Public Gateway
1617
upgrade Upgrade a Public Gateway to the latest version and/or to a different commercial offer type

docs/commands/vpc-gw.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This API allows you to manage your Public Gateways.
2121
- [Upgrade a Public Gateway to IP mobility](#upgrade-a-public-gateway-to-ip-mobility)
2222
- [Get a Public Gateway](#get-a-public-gateway)
2323
- [List Public Gateways](#list-public-gateways)
24+
- [Put a Public Gateway in IPAM mode](#put-a-public-gateway-in-ipam-mode)
2425
- [Refresh a Public Gateway's SSH keys](#refresh-a-public-gateway's-ssh-keys)
2526
- [Update a Public Gateway](#update-a-public-gateway)
2627
- [Upgrade a Public Gateway to the latest version and/or to a different commercial offer type](#upgrade-a-public-gateway-to-the-latest-version-andor-to-a-different-commercial-offer-type)
@@ -438,6 +439,26 @@ scw vpc-gw gateway list [arg=value ...]
438439

439440

440441

442+
### Put a Public Gateway in IPAM mode
443+
444+
Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent.
445+
446+
**Usage:**
447+
448+
```
449+
scw vpc-gw gateway migrate-to-v2 <gateway-id ...> [arg=value ...]
450+
```
451+
452+
453+
**Args:**
454+
455+
| Name | | Description |
456+
|------|---|-------------|
457+
| gateway-id | Required | ID of the gateway to put into IPAM mode |
458+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `nl-ams-3`, `pl-waw-1`, `pl-waw-2`, `pl-waw-3` | Zone to target. If none is passed will use default zone from the config |
459+
460+
461+
441462
### Refresh a Public Gateway's SSH keys
442463

443464
Refresh the SSH keys of a given Public Gateway, specified by its gateway ID. This adds any new SSH keys in the gateway's Scaleway Project to the gateway itself.

internal/namespaces/vpcgw/v1/vpcgw_cli.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func GetGeneratedCommands() *core.Commands {
6363
vpcGwIPUpdate(),
6464
vpcGwIPDelete(),
6565
vpcGwGatewayRefreshSSHKeys(),
66+
vpcGwGatewayMigrateToV2(),
6667
)
6768
}
6869
func vpcGwRoot() *core.Command {
@@ -2259,3 +2260,39 @@ func vpcGwGatewayRefreshSSHKeys() *core.Command {
22592260
},
22602261
}
22612262
}
2263+
2264+
func vpcGwGatewayMigrateToV2() *core.Command {
2265+
return &core.Command{
2266+
Short: `Put a Public Gateway in IPAM mode`,
2267+
Long: `Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent.`,
2268+
Namespace: "vpc-gw",
2269+
Resource: "gateway",
2270+
Verb: "migrate-to-v2",
2271+
// Deprecated: false,
2272+
ArgsType: reflect.TypeOf(vpcgw.MigrateToV2Request{}),
2273+
ArgSpecs: core.ArgSpecs{
2274+
{
2275+
Name: "gateway-id",
2276+
Short: `ID of the gateway to put into IPAM mode`,
2277+
Required: true,
2278+
Deprecated: false,
2279+
Positional: true,
2280+
},
2281+
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZoneNlAms3, scw.ZonePlWaw1, scw.ZonePlWaw2, scw.ZonePlWaw3),
2282+
},
2283+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
2284+
request := args.(*vpcgw.MigrateToV2Request)
2285+
2286+
client := core.ExtractClient(ctx)
2287+
api := vpcgw.NewAPI(client)
2288+
e = api.MigrateToV2(request)
2289+
if e != nil {
2290+
return nil, e
2291+
}
2292+
return &core.SuccessResult{
2293+
Resource: "gateway",
2294+
Verb: "migrate-to-v2",
2295+
}, nil
2296+
},
2297+
}
2298+
}

0 commit comments

Comments
 (0)