Skip to content

Commit 5a704db

Browse files
authored
feat(vpcgw): enable refresh-ssh-keys code generation on cli (#2783)
1 parent 0253e89 commit 5a704db

File tree

6 files changed

+81
-9
lines changed

6 files changed

+81
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Refresh SSH keys of a VPC Public Gateway.
4+
5+
USAGE:
6+
scw vpc-gw gateway refresh-ssh-keys <gateway-id ...> [arg=value ...]
7+
8+
ARGS:
9+
gateway-id ID of the gateway that needs fresh ssh keys
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 | pl-waw-1 | pl-waw-2)
11+
12+
FLAGS:
13+
-h, --help help for refresh-ssh-keys
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

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ USAGE:
66
scw vpc-gw gateway <command>
77

88
AVAILABLE COMMANDS:
9-
create Create a VPC Public Gateway
10-
delete Delete a VPC Public Gateway
11-
get Get a VPC Public Gateway
12-
list List VPC Public Gateways
13-
update Update a VPC Public Gateway
14-
upgrade Upgrade a VPC Public Gateway to the latest version
9+
create Create a VPC Public Gateway
10+
delete Delete a VPC Public Gateway
11+
get Get a VPC Public Gateway
12+
list List VPC Public Gateways
13+
refresh-ssh-keys Refresh SSH keys of a VPC Public Gateway
14+
update Update a VPC Public Gateway
15+
upgrade Upgrade a VPC Public Gateway to the latest version
1516

1617
FLAGS:
1718
-h, --help help for gateway

docs/commands/vpc-gw.md

+21
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ VPC Public Gateway API
2020
- [Delete a VPC Public Gateway](#delete-a-vpc-public-gateway)
2121
- [Get a VPC Public Gateway](#get-a-vpc-public-gateway)
2222
- [List VPC Public Gateways](#list-vpc-public-gateways)
23+
- [Refresh SSH keys of a VPC Public Gateway](#refresh-ssh-keys-of-a-vpc-public-gateway)
2324
- [Update a VPC Public Gateway](#update-a-vpc-public-gateway)
2425
- [Upgrade a VPC Public Gateway to the latest version](#upgrade-a-vpc-public-gateway-to-the-latest-version)
2526
- [Gateway Networks management](#gateway-networks-management)
@@ -426,6 +427,26 @@ scw vpc-gw gateway list [arg=value ...]
426427

427428

428429

430+
### Refresh SSH keys of a VPC Public Gateway
431+
432+
Refresh SSH keys of a VPC Public Gateway.
433+
434+
**Usage:**
435+
436+
```
437+
scw vpc-gw gateway refresh-ssh-keys <gateway-id ...> [arg=value ...]
438+
```
439+
440+
441+
**Args:**
442+
443+
| Name | | Description |
444+
|------|---|-------------|
445+
| gateway-id | Required | ID of the gateway that needs fresh ssh keys |
446+
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `nl-ams-1`, `nl-ams-2`, `pl-waw-1`, `pl-waw-2` | Zone to target. If none is passed will use default zone from the config |
447+
448+
449+
429450
### Update a VPC Public Gateway
430451

431452
Update a VPC Public Gateway.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/kubernetes-client/go-base v0.0.0-20190205182333-3d0e39759d98
1919
github.com/mattn/go-colorable v0.1.13
2020
github.com/mattn/go-isatty v0.0.17
21-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230215160259-75d87198bf2f
21+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230217153227-7f6724a253f6
2222
github.com/spf13/cobra v1.6.1
2323
github.com/spf13/pflag v1.0.5
2424
github.com/stretchr/testify v1.8.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw
7070
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
7171
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7272
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
73-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230215160259-75d87198bf2f h1:9arSOEBwiL8hgg7IyKPLwK9NlTUbWiGXe6xQrryNxjk=
74-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230215160259-75d87198bf2f/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
73+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230217153227-7f6724a253f6 h1:hu/JVNLKhZ32sEvzy59lgay53Vz/oO+J+RdzrrDsRjw=
74+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.13.0.20230217153227-7f6724a253f6/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
7575
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
7676
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
7777
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=

internal/namespaces/vpcgw/v1/vpcgw_cli.go

+31
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func GetGeneratedCommands() *core.Commands {
6161
vpcGwIPCreate(),
6262
vpcGwIPUpdate(),
6363
vpcGwIPDelete(),
64+
vpcGwGatewayRefreshSSHKeys(),
6465
)
6566
}
6667
func vpcGwRoot() *core.Command {
@@ -2195,3 +2196,33 @@ func vpcGwIPDelete() *core.Command {
21952196
},
21962197
}
21972198
}
2199+
2200+
func vpcGwGatewayRefreshSSHKeys() *core.Command {
2201+
return &core.Command{
2202+
Short: `Refresh SSH keys of a VPC Public Gateway`,
2203+
Long: `Refresh SSH keys of a VPC Public Gateway.`,
2204+
Namespace: "vpc-gw",
2205+
Resource: "gateway",
2206+
Verb: "refresh-ssh-keys",
2207+
// Deprecated: false,
2208+
ArgsType: reflect.TypeOf(vpcgw.RefreshSSHKeysRequest{}),
2209+
ArgSpecs: core.ArgSpecs{
2210+
{
2211+
Name: "gateway-id",
2212+
Short: `ID of the gateway that needs fresh ssh keys`,
2213+
Required: true,
2214+
Deprecated: false,
2215+
Positional: true,
2216+
},
2217+
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw1, scw.ZonePlWaw2),
2218+
},
2219+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
2220+
request := args.(*vpcgw.RefreshSSHKeysRequest)
2221+
2222+
client := core.ExtractClient(ctx)
2223+
api := vpcgw.NewAPI(client)
2224+
return api.RefreshSSHKeys(request)
2225+
2226+
},
2227+
}
2228+
}

0 commit comments

Comments
 (0)