Skip to content

Commit 224bafd

Browse files
authored
feat(vpc): add beta support for regional vpc (#3210)
1 parent a5bea53 commit 224bafd

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

internal/namespaces/get_commands.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ import (
3636
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/shell"
3737
tem "github.com/scaleway/scaleway-cli/v2/internal/namespaces/tem/v1alpha1"
3838
versionNamespace "github.com/scaleway/scaleway-cli/v2/internal/namespaces/version"
39-
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpc/v1"
39+
vpcV1 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpc/v1"
40+
vpcV2 "github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpc/v2"
4041
"github.com/scaleway/scaleway-cli/v2/internal/namespaces/vpcgw/v1"
4142
webhosting "github.com/scaleway/scaleway-cli/v2/internal/namespaces/webhosting/v1alpha1"
43+
"github.com/scaleway/scaleway-sdk-go/scw"
4244
)
4345

4446
var labs = os.Getenv("SCW_ENABLE_LABS") == "true"
4547

4648
// Enable beta in the code when products are in beta
47-
// var beta = os.Getenv(scw.ScwEnableBeta) == "true"
49+
var beta = os.Getenv(scw.ScwEnableBeta) == "true"
4850

4951
// GetCommands returns a list of all commands in the CLI.
5052
// It is used by both scw and scw-qa.
@@ -72,7 +74,7 @@ func GetCommands() *core.Commands {
7274
lb.GetCommands(),
7375
iot.GetCommands(),
7476
help.GetCommands(),
75-
vpc.GetCommands(),
77+
vpcV1.GetCommands(),
7678
domain.GetCommands(),
7779
applesilicon.GetCommands(),
7880
flexibleip.GetCommands(),
@@ -91,6 +93,9 @@ func GetCommands() *core.Commands {
9193
if labs {
9294
commands.Merge(ipfs.GetCommands())
9395
}
96+
if beta {
97+
commands.Merge(vpcV2.GetCommands())
98+
}
9499

95100
return commands
96101
}

internal/namespaces/vpc/v2/custom.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package vpc
2+
3+
import (
4+
"github.com/scaleway/scaleway-cli/v2/internal/core"
5+
)
6+
7+
func GetCommands() *core.Commands {
8+
cmds := GetGeneratedCommands()
9+
for _, cmd := range cmds.GetAll() {
10+
cmd.Namespace = "vpc_v2"
11+
}
12+
return cmds
13+
}

0 commit comments

Comments
 (0)