Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent.

USAGE:
scw vpc-gw gateway migrate-to-v2 <gateway-id ...> [arg=value ...]

ARGS:
gateway-id ID of the gateway to put into IPAM mode
[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)

FLAGS:
-h, --help help for migrate-to-v2

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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ AVAILABLE COMMANDS:
enable-ip-mobility Upgrade a Public Gateway to IP mobility
get Get a Public Gateway
list List Public Gateways
migrate-to-v2 Put a Public Gateway in IPAM mode
refresh-ssh-keys Refresh a Public Gateway's SSH keys
update Update a Public Gateway
upgrade Upgrade a Public Gateway to the latest version and/or to a different commercial offer type
Expand Down
21 changes: 21 additions & 0 deletions docs/commands/vpc-gw.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This API allows you to manage your Public Gateways.
- [Upgrade a Public Gateway to IP mobility](#upgrade-a-public-gateway-to-ip-mobility)
- [Get a Public Gateway](#get-a-public-gateway)
- [List Public Gateways](#list-public-gateways)
- [Put a Public Gateway in IPAM mode](#put-a-public-gateway-in-ipam-mode)
- [Refresh a Public Gateway's SSH keys](#refresh-a-public-gateway's-ssh-keys)
- [Update a Public Gateway](#update-a-public-gateway)
- [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)
Expand Down Expand Up @@ -438,6 +439,26 @@ scw vpc-gw gateway list [arg=value ...]



### Put a Public Gateway in IPAM mode

Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent.

**Usage:**

```
scw vpc-gw gateway migrate-to-v2 <gateway-id ...> [arg=value ...]
```


**Args:**

| Name | | Description |
|------|---|-------------|
| gateway-id | Required | ID of the gateway to put into IPAM mode |
| 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 |



### Refresh a Public Gateway's SSH keys

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.
Expand Down
37 changes: 37 additions & 0 deletions internal/namespaces/vpcgw/v1/vpcgw_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func GetGeneratedCommands() *core.Commands {
vpcGwIPUpdate(),
vpcGwIPDelete(),
vpcGwGatewayRefreshSSHKeys(),
vpcGwGatewayMigrateToV2(),
)
}
func vpcGwRoot() *core.Command {
Expand Down Expand Up @@ -2259,3 +2260,39 @@ func vpcGwGatewayRefreshSSHKeys() *core.Command {
},
}
}

func vpcGwGatewayMigrateToV2() *core.Command {
return &core.Command{
Short: `Put a Public Gateway in IPAM mode`,
Long: `Put a Public Gateway in IPAM mode, so that it can be used with the Public Gateways API v2. This call is idempotent.`,
Namespace: "vpc-gw",
Resource: "gateway",
Verb: "migrate-to-v2",
// Deprecated: false,
ArgsType: reflect.TypeOf(vpcgw.MigrateToV2Request{}),
ArgSpecs: core.ArgSpecs{
{
Name: "gateway-id",
Short: `ID of the gateway to put into IPAM mode`,
Required: true,
Deprecated: false,
Positional: true,
},
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZoneNlAms3, scw.ZonePlWaw1, scw.ZonePlWaw2, scw.ZonePlWaw3),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*vpcgw.MigrateToV2Request)

client := core.ExtractClient(ctx)
api := vpcgw.NewAPI(client)
e = api.MigrateToV2(request)
if e != nil {
return nil, e
}
return &core.SuccessResult{
Resource: "gateway",
Verb: "migrate-to-v2",
}, nil
},
}
}