Skip to content

Commit 85a354b

Browse files
authored
feat(vpc): add route resource (#3986)
1 parent cf91286 commit 85a354b

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

cmd/scw/testdata/test-all-usage-vpc-vpc-usage.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3-
A Virtual Private Cloud (VPC) allows you to group your regional
4-
Private Networks together. Note that a Private Network can be a
3+
A Virtual Private Cloud (VPC) allows you to group your regional
4+
Private Networks together. Note that a Private Network can be a
55
part of only one VPC.
66

77
USAGE:

docs/commands/vpc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ scw vpc subnet
232232

233233
## VPC management command
234234

235-
A Virtual Private Cloud (VPC) allows you to group your regional
236-
Private Networks together. Note that a Private Network can be a
235+
A Virtual Private Cloud (VPC) allows you to group your regional
236+
Private Networks together. Note that a Private Network can be a
237237
part of only one VPC.
238238

239239

internal/core/command.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,14 @@ func (c *Commands) Remove(namespace, verb string) {
263263
}
264264
}
265265

266+
func (c *Commands) RemoveResource(namespace, resource string) {
267+
for i := range c.commands {
268+
if c.commands[i].Namespace == namespace && c.commands[i].Resource == resource && c.commands[i].Verb == "" {
269+
c.commands = append(c.commands[:i], c.commands[i+1:]...)
270+
return
271+
}
272+
}
273+
}
266274
func (c *Commands) Add(cmd *Command) {
267275
c.commands = append(c.commands, cmd)
268276
c.commandIndex[cmd.getPath()] = cmd

internal/namespaces/vpc/v2/custom.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ func GetCommands() *core.Commands {
1010
cmds := GetGeneratedCommands()
1111

1212
cmds.Remove("vpc", "post")
13+
cmds.RemoveResource("vpc", "route")
1314
cmds.MustFind("vpc", "private-network", "get").Override(privateNetworkGetBuilder)
1415
human.RegisterMarshalerFunc(vpc.PrivateNetwork{}, privateNetworkMarshalerFunc)
1516

internal/namespaces/vpc/v2/vpc_cli.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func GetGeneratedCommands() *core.Commands {
2323
vpcVpc(),
2424
vpcPrivateNetwork(),
2525
vpcSubnet(),
26+
vpcRoute(),
2627
vpcRoutes(),
2728
vpcVpcList(),
2829
vpcVpcCreate(),
@@ -50,8 +51,8 @@ func vpcRoot() *core.Command {
5051
func vpcVpc() *core.Command {
5152
return &core.Command{
5253
Short: `VPC management command`,
53-
Long: `A Virtual Private Cloud (VPC) allows you to group your regional
54-
Private Networks together. Note that a Private Network can be a
54+
Long: `A Virtual Private Cloud (VPC) allows you to group your regional
55+
Private Networks together. Note that a Private Network can be a
5556
part of only one VPC.`,
5657
Namespace: "vpc",
5758
Resource: "vpc",
@@ -79,6 +80,15 @@ func vpcSubnet() *core.Command {
7980
}
8081
}
8182

83+
func vpcRoute() *core.Command {
84+
return &core.Command{
85+
Short: `Route management command`,
86+
Long: `Custom routes.`,
87+
Namespace: "vpc",
88+
Resource: "route",
89+
}
90+
}
91+
8292
func vpcRoutes() *core.Command {
8393
return &core.Command{
8494
Short: `Routes management command`,

0 commit comments

Comments
 (0)