Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vpc): add support for VPC private-network #1420

Merged
merged 8 commits into from
Sep 14, 2020
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,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Create a private network.

USAGE:
scw vpc private-network create [arg=value ...]

ARGS:
[project-id] Project ID to use. If none is passed will use default project ID from the config
name=<generated> The name of the private network
[tags.{index}] The private networks tags
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)

FLAGS:
-h, --help help for create

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
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Delete a private network.

USAGE:
scw vpc private-network delete <private-network-id ...> [arg=value ...]

ARGS:
private-network-id The private network ID
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)

FLAGS:
-h, --help help for delete

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
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Get a private network.

USAGE:
scw vpc private-network get <private-network-id ...> [arg=value ...]

ARGS:
private-network-id The private network id
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)

FLAGS:
-h, --help help for get

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
@@ -0,0 +1,23 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List private networks.

USAGE:
scw vpc private-network list [arg=value ...]

ARGS:
[order-by] The sort order of the returned private networks (created_at_asc | created_at_desc | name_asc | name_desc)
[name] Filter private networks with names containing this string
[tags.{index}] Filter private networks with one or more matching tags
[project-id] The project ID on which to filter the returned private networks
[organization-id] The organization ID on which to filter the returned private networks
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)

FLAGS:
-h, --help help for list

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
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Update private network.

USAGE:
scw vpc private-network update <private-network-id ...> [arg=value ...]

ARGS:
private-network-id The private network ID
[name] The name of the private network
[tags.{index}] The private networks tags
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | nl-ams-1)

FLAGS:
-h, --help help for update

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
@@ -0,0 +1,30 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
A private network allows interconnecting your instances in an
isolated and private network. The network reachability is limited
to the instances that are on the same private network. Network
Interface Controllers (NICs) are available on the instance and can
be freely managed (adding IP addresses, shutdown interface...)

Note that an instance can be a part of multiple private networks.

USAGE:
scw vpc private-network <command>

AVAILABLE COMMANDS:
create Create a private network
delete Delete a private network
get Get a private network
list List private networks
update Update private network

FLAGS:
-h, --help help for private-network

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

Use "scw vpc private-network [command] --help" for more information about a command.
20 changes: 20 additions & 0 deletions cmd/scw/testdata/test-all-usage-vpc-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
VPC API

USAGE:
scw vpc <command>

AVAILABLE COMMANDS:
private-network Private network management command

FLAGS:
-h, --help help for vpc

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

Use "scw vpc [command] --help" for more information about a command.
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-main-usage-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ AVAILABLE COMMANDS:
rdb Database RDB API
registry Container registry API
version Display cli version
vpc VPC API
help Help about any command

FLAGS:
Expand Down
2 changes: 2 additions & 0 deletions internal/namespaces/get_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/scaleway/scaleway-cli/internal/namespaces/rdb/v1"
"github.com/scaleway/scaleway-cli/internal/namespaces/registry/v1"
versionNamespace "github.com/scaleway/scaleway-cli/internal/namespaces/version"
"github.com/scaleway/scaleway-cli/internal/namespaces/vpc/v1"
)

// GetCommands returns a list of all commands in the CLI.
Expand All @@ -45,5 +46,6 @@ func GetCommands() *core.Commands {
commands.Merge(lb.GetCommands())
commands.Merge(iot.GetCommands())
commands.Merge(help.GetCommands())
commands.Merge(vpc.GetCommands())
return commands
}
11 changes: 11 additions & 0 deletions internal/namespaces/vpc/v1/custom.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package vpc

import (
"github.com/scaleway/scaleway-cli/internal/core"
)

func GetCommands() *core.Commands {
cmds := GetGeneratedCommands()

return cmds
}
Loading