From 3ddedb4e1e074bb6fe94d31388b7daa903ad9a0a Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Fri, 11 Sep 2020 14:34:46 +0000 Subject: [PATCH 1/6] feat(vpc): Update api.yml following project integration --- internal/namespaces/vpc/v1/vpc_cli.go | 224 ++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 internal/namespaces/vpc/v1/vpc_cli.go diff --git a/internal/namespaces/vpc/v1/vpc_cli.go b/internal/namespaces/vpc/v1/vpc_cli.go new file mode 100644 index 0000000000..d7ea9166e5 --- /dev/null +++ b/internal/namespaces/vpc/v1/vpc_cli.go @@ -0,0 +1,224 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. + +package vpc + +import ( + "context" + "reflect" + + "github.com/scaleway/scaleway-cli/internal/core" + "github.com/scaleway/scaleway-sdk-go/api/vpc/v1" + "github.com/scaleway/scaleway-sdk-go/scw" +) + +// always import dependencies +var ( + _ = scw.RegionFrPar +) + +func GetGeneratedCommands() *core.Commands { + return core.NewCommands( + vpcRoot(), + vpcPrivateNetwork(), + vpcPrivateNetworkList(), + vpcPrivateNetworkCreate(), + vpcPrivateNetworkUpdate(), + vpcPrivateNetworkDelete(), + ) +} +func vpcRoot() *core.Command { + return &core.Command{ + Short: `VPC API`, + Long: ``, + Namespace: "vpc", + } +} + +func vpcPrivateNetwork() *core.Command { + return &core.Command{ + Short: `Private network management command`, + Long: `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. +`, + Namespace: "vpc", + Resource: "private-network", + } +} + +func vpcPrivateNetworkList() *core.Command { + return &core.Command{ + Short: `List private networks`, + Long: `List private networks.`, + Namespace: "vpc", + Resource: "private-network", + Verb: "list", + ArgsType: reflect.TypeOf(vpc.ListPrivateNetworksRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "order-by", + Short: `The sort order of the returned private networks`, + Required: false, + Positional: false, + EnumValues: []string{"created_at_asc", "created_at_desc", "name_asc", "name_desc"}, + }, + { + Name: "name", + Short: `Filter private networks with names containing this string`, + Required: false, + Positional: false, + }, + { + Name: "tags.{index}", + Short: `Filter private networks with one or more matching tags`, + Required: false, + Positional: false, + }, + { + Name: "project-id", + Short: `The project ID on which to filter the returned private networks`, + Required: false, + Positional: false, + }, + { + Name: "organization-id", + Short: `The organization ID on which to filter the returned private networks`, + Required: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*vpc.ListPrivateNetworksRequest) + + client := core.ExtractClient(ctx) + api := vpc.NewAPI(client) + resp, err := api.ListPrivateNetworks(request, scw.WithAllPages()) + if err != nil { + return nil, err + } + return resp.PrivateNetworks, nil + + }, + } +} + +func vpcPrivateNetworkCreate() *core.Command { + return &core.Command{ + Short: `Create a private network`, + Long: `Create a private network.`, + Namespace: "vpc", + Resource: "private-network", + Verb: "create", + ArgsType: reflect.TypeOf(vpc.CreatePrivateNetworkRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "name", + Short: `The name of the private network`, + Required: true, + Positional: false, + Default: core.RandomValueGenerator("pn"), + }, + { + Name: "project-id", + Short: `The project ID of the private network`, + Required: true, + Positional: false, + }, + { + Name: "tags.{index}", + Short: `The private networks tags`, + Required: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*vpc.CreatePrivateNetworkRequest) + + client := core.ExtractClient(ctx) + api := vpc.NewAPI(client) + return api.CreatePrivateNetwork(request) + + }, + } +} + +func vpcPrivateNetworkUpdate() *core.Command { + return &core.Command{ + Short: `Update private network`, + Long: `Update private network.`, + Namespace: "vpc", + Resource: "private-network", + Verb: "update", + ArgsType: reflect.TypeOf(vpc.UpdatePrivateNetworkRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "private-network-id", + Short: `The private network ID`, + Required: true, + Positional: false, + }, + { + Name: "name", + Short: `The name of the private network`, + Required: false, + Positional: false, + }, + { + Name: "tags.{index}", + Short: `The private networks tags`, + Required: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*vpc.UpdatePrivateNetworkRequest) + + client := core.ExtractClient(ctx) + api := vpc.NewAPI(client) + return api.UpdatePrivateNetwork(request) + + }, + } +} + +func vpcPrivateNetworkDelete() *core.Command { + return &core.Command{ + Short: `Delete a private network`, + Long: `Delete a private network.`, + Namespace: "vpc", + Resource: "private-network", + Verb: "delete", + ArgsType: reflect.TypeOf(vpc.DeletePrivateNetworkRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "private-network-id", + Short: `The private network ID`, + Required: true, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*vpc.DeletePrivateNetworkRequest) + + client := core.ExtractClient(ctx) + api := vpc.NewAPI(client) + e = api.DeletePrivateNetwork(request) + if e != nil { + return nil, e + } + return &core.SuccessResult{ + Resource: "private-network", + Verb: "delete", + }, nil + }, + } +} From b906d4c1ea36e5e3cfe505c84ec13ab8eacb7521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Fri, 11 Sep 2020 17:06:52 +0200 Subject: [PATCH 2/6] bump sdk --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 88acafad3d..c55efdf58b 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/mattn/go-colorable v0.1.4 github.com/mattn/go-isatty v0.0.11 github.com/pkg/errors v0.9.1 // indirect - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200908180425-0a4ce2d8f2ad + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200911150340-00656aa3a030 github.com/sergi/go-diff v1.0.0 // indirect github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index fe2187921b..95cea58770 100644 --- a/go.sum +++ b/go.sum @@ -64,6 +64,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200908180425-0a4ce2d8f2ad h1:s0ZGnCDNJAbkQqOKCjzoAKNBPQyvrZUaWLKUtDKPIcc= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200908180425-0a4ce2d8f2ad/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200911150340-00656aa3a030 h1:v4Ge/Hm1UnrDP83PG7Spt2dYJT/3+ppruwdYbJ658A4= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.6.0.20200911150340-00656aa3a030/go.mod h1:CJJ5VAbozOl0yEw7nHB9+7BXTJbIn6h7W+f6Gau5IP8= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= From 587e6e5bdbc60c322935fa00a53bb2111aca05e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Fri, 11 Sep 2020 17:12:20 +0200 Subject: [PATCH 3/6] Fix --- ...ge-vpc-private-network-create-usage.golden | 21 ++++++++++++++ ...ge-vpc-private-network-delete-usage.golden | 19 ++++++++++++ ...sage-vpc-private-network-list-usage.golden | 23 +++++++++++++++ ...ge-vpc-private-network-update-usage.golden | 21 ++++++++++++++ ...all-usage-vpc-private-network-usage.golden | 29 +++++++++++++++++++ .../testdata/test-all-usage-vpc-usage.golden | 20 +++++++++++++ cmd/scw/testdata/test-main-usage-usage.golden | 1 + internal/namespaces/get_commands.go | 2 ++ internal/namespaces/vpc/v1/custom.go | 11 +++++++ 9 files changed, 147 insertions(+) create mode 100644 cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-vpc-private-network-delete-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-vpc-private-network-list-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-vpc-private-network-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-vpc-usage.golden create mode 100644 internal/namespaces/vpc/v1/custom.go diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden new file mode 100644 index 0000000000..9c121b9703 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Create a private network. + +USAGE: + scw vpc private-network create [arg=value ...] + +ARGS: + name= The name of the private network + project-id The project ID 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 diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-delete-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-delete-usage.golden new file mode 100644 index 0000000000..9a7e631eb5 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-delete-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete a private network. + +USAGE: + scw vpc private-network delete [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 diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-list-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-list-usage.golden new file mode 100644 index 0000000000..70778fd1e9 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-list-usage.golden @@ -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 diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden new file mode 100644 index 0000000000..6c6e183832 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Update private network. + +USAGE: + scw vpc private-network update [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 diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-usage.golden new file mode 100644 index 0000000000..f2e94258de --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-usage.golden @@ -0,0 +1,29 @@ +🎲🎲🎲 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 + +AVAILABLE COMMANDS: + create Create a private network + delete Delete 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. diff --git a/cmd/scw/testdata/test-all-usage-vpc-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-usage.golden new file mode 100644 index 0000000000..21db537aab --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +VPC API + +USAGE: + scw vpc + +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. diff --git a/cmd/scw/testdata/test-main-usage-usage.golden b/cmd/scw/testdata/test-main-usage-usage.golden index 7af89129f2..c711fa1b6e 100644 --- a/cmd/scw/testdata/test-main-usage-usage.golden +++ b/cmd/scw/testdata/test-main-usage-usage.golden @@ -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: diff --git a/internal/namespaces/get_commands.go b/internal/namespaces/get_commands.go index ef2a8bc2a3..cb255ece71 100644 --- a/internal/namespaces/get_commands.go +++ b/internal/namespaces/get_commands.go @@ -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. @@ -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 } diff --git a/internal/namespaces/vpc/v1/custom.go b/internal/namespaces/vpc/v1/custom.go new file mode 100644 index 0000000000..0d0d80dad0 --- /dev/null +++ b/internal/namespaces/vpc/v1/custom.go @@ -0,0 +1,11 @@ +package vpc + +import ( + "github.com/scaleway/scaleway-cli/internal/core" +) + +func GetCommands() *core.Commands { + cmds := GetGeneratedCommands() + + return cmds +} From 889e45ab85d2208e54c4677b50dbb18fef43d685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Mon, 14 Sep 2020 11:16:33 +0200 Subject: [PATCH 4/6] Fix --- internal/namespaces/vpc/v1/vpc_cli.go | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/internal/namespaces/vpc/v1/vpc_cli.go b/internal/namespaces/vpc/v1/vpc_cli.go index d7ea9166e5..8c1d701e1d 100644 --- a/internal/namespaces/vpc/v1/vpc_cli.go +++ b/internal/namespaces/vpc/v1/vpc_cli.go @@ -23,6 +23,7 @@ func GetGeneratedCommands() *core.Commands { vpcPrivateNetwork(), vpcPrivateNetworkList(), vpcPrivateNetworkCreate(), + vpcPrivateNetworkGet(), vpcPrivateNetworkUpdate(), vpcPrivateNetworkDelete(), ) @@ -149,6 +150,34 @@ func vpcPrivateNetworkCreate() *core.Command { } } +func vpcPrivateNetworkGet() *core.Command { + return &core.Command{ + Short: `Get a private network`, + Long: `Get a private network.`, + Namespace: "vpc", + Resource: "private-network", + Verb: "get", + ArgsType: reflect.TypeOf(vpc.GetPrivateNetworkRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "private-network-id", + Short: `The private network id`, + Required: true, + Positional: true, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*vpc.GetPrivateNetworkRequest) + + client := core.ExtractClient(ctx) + api := vpc.NewAPI(client) + return api.GetPrivateNetwork(request) + + }, + } +} + func vpcPrivateNetworkUpdate() *core.Command { return &core.Command{ Short: `Update private network`, From ce3f624482eed4c1bc2b0802dd038ac3a36b41ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Mon, 14 Sep 2020 11:56:16 +0200 Subject: [PATCH 5/6] Fix --- internal/namespaces/vpc/v1/vpc_cli.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/namespaces/vpc/v1/vpc_cli.go b/internal/namespaces/vpc/v1/vpc_cli.go index 8c1d701e1d..babd7c3ac5 100644 --- a/internal/namespaces/vpc/v1/vpc_cli.go +++ b/internal/namespaces/vpc/v1/vpc_cli.go @@ -191,7 +191,7 @@ func vpcPrivateNetworkUpdate() *core.Command { Name: "private-network-id", Short: `The private network ID`, Required: true, - Positional: false, + Positional: true, }, { Name: "name", @@ -231,7 +231,7 @@ func vpcPrivateNetworkDelete() *core.Command { Name: "private-network-id", Short: `The private network ID`, Required: true, - Positional: false, + Positional: true, }, core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneNlAms1), }, From 721de1883dc146e9c6dde1c0973ea1236bffa459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Mon, 14 Sep 2020 12:00:19 +0200 Subject: [PATCH 6/6] Fix --- ...ge-vpc-private-network-create-usage.golden | 2 +- ...ge-vpc-private-network-delete-usage.golden | 2 +- ...usage-vpc-private-network-get-usage.golden | 19 +++++++++++++++++++ ...ge-vpc-private-network-update-usage.golden | 2 +- ...all-usage-vpc-private-network-usage.golden | 1 + internal/namespaces/vpc/v1/vpc_cli.go | 7 +------ 6 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 cmd/scw/testdata/test-all-usage-vpc-private-network-get-usage.golden diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden index 9c121b9703..0a4e775248 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-create-usage.golden @@ -6,8 +6,8 @@ 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= The name of the private network - project-id The project ID 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) diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-delete-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-delete-usage.golden index 9a7e631eb5..b49f17e49a 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-private-network-delete-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-delete-usage.golden @@ -3,7 +3,7 @@ Delete a private network. USAGE: - scw vpc private-network delete [arg=value ...] + scw vpc private-network delete [arg=value ...] ARGS: private-network-id The private network ID diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-get-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-get-usage.golden new file mode 100644 index 0000000000..544c27c818 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get a private network. + +USAGE: + scw vpc private-network get [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 diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden index 6c6e183832..bf071f0384 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-update-usage.golden @@ -3,7 +3,7 @@ Update private network. USAGE: - scw vpc private-network update [arg=value ...] + scw vpc private-network update [arg=value ...] ARGS: private-network-id The private network ID diff --git a/cmd/scw/testdata/test-all-usage-vpc-private-network-usage.golden b/cmd/scw/testdata/test-all-usage-vpc-private-network-usage.golden index f2e94258de..400357a313 100644 --- a/cmd/scw/testdata/test-all-usage-vpc-private-network-usage.golden +++ b/cmd/scw/testdata/test-all-usage-vpc-private-network-usage.golden @@ -14,6 +14,7 @@ USAGE: 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 diff --git a/internal/namespaces/vpc/v1/vpc_cli.go b/internal/namespaces/vpc/v1/vpc_cli.go index babd7c3ac5..4e9fef1ec4 100644 --- a/internal/namespaces/vpc/v1/vpc_cli.go +++ b/internal/namespaces/vpc/v1/vpc_cli.go @@ -118,6 +118,7 @@ func vpcPrivateNetworkCreate() *core.Command { Verb: "create", ArgsType: reflect.TypeOf(vpc.CreatePrivateNetworkRequest{}), ArgSpecs: core.ArgSpecs{ + core.ProjectIDArgSpec(), { Name: "name", Short: `The name of the private network`, @@ -125,12 +126,6 @@ func vpcPrivateNetworkCreate() *core.Command { Positional: false, Default: core.RandomValueGenerator("pn"), }, - { - Name: "project-id", - Short: `The project ID of the private network`, - Required: true, - Positional: false, - }, { Name: "tags.{index}", Short: `The private networks tags`,