Skip to content

Commit 7284ab7

Browse files
committed
feat(vpc): disable route resource
1 parent b84f19c commit 7284ab7

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ USAGE:
77

88
AVAILABLE COMMANDS:
99
private-network Private network management command
10-
route Route management command
1110
routes Routes management command
1211
subnet Subnet management command
1312
vpc VPC management command

docs/commands/vpc.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ This API allows you to manage your Virtual Private Clouds (VPCs) and Private Net
1010
- [List Private Networks](#list-private-networks)
1111
- [Migrate Private Networks from zoned to regional](#migrate-private-networks-from-zoned-to-regional)
1212
- [Update Private Network](#update-private-network)
13-
- [Route management command](#route-management-command)
1413
- [Routes management command](#routes-management-command)
1514
- [Return routes with associated next hop data](#return-routes-with-associated-next-hop-data)
1615
- [Subnet management command](#subnet-management-command)
@@ -185,20 +184,6 @@ scw vpc private-network update <private-network-id ...> [arg=value ...]
185184

186185

187186

188-
## Route management command
189-
190-
Custom routes.
191-
192-
Custom routes.
193-
194-
**Usage:**
195-
196-
```
197-
scw vpc route
198-
```
199-
200-
201-
202187
## Routes management command
203188

204189
Routes management command.

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

0 commit comments

Comments
 (0)