diff --git a/cmd/scw/testdata/test-all-usage-baremetal-options-add-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-options-add-usage.golden new file mode 100644 index 0000000000..9dcbcdeef9 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-baremetal-options-add-usage.golden @@ -0,0 +1,25 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Add an option to a specific server. + +USAGE: + scw baremetal options add [arg=value ...] + +EXAMPLES: + Add a given option to a server + scw baremetal options add server-id=11111111-1111-1111-1111-111111111111 option-id=11111111-1111-1111-1111-111111111111 + +ARGS: + server-id ID of the server + option-id ID of the option to add + [expires-at] Auto expire the option after this date + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1) + +FLAGS: + -h, --help help for add + +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-baremetal-options-delete-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-options-delete-usage.golden new file mode 100644 index 0000000000..08ac84e850 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-baremetal-options-delete-usage.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete an option from a specific server. + +USAGE: + scw baremetal options delete [arg=value ...] + +EXAMPLES: + Delete a given option from a server + scw baremetal options delete server-id=11111111-1111-1111-1111-111111111111 option-id=11111111-1111-1111-1111-111111111111 + +ARGS: + server-id ID of the server + option-id ID of the option to delete + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | 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-baremetal-options-get-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-options-get-usage.golden new file mode 100644 index 0000000000..c15a463a18 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-baremetal-options-get-usage.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Return specific option for the given ID. + +USAGE: + scw baremetal options get [arg=value ...] + +EXAMPLES: + Get a server option with the given ID + scw baremetal options get zone=fr-par-1 option-id=11111111-1111-1111-1111-111111111111 + +ARGS: + option-id ID of the option + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | 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-baremetal-options-list-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-options-list-usage.golden new file mode 100644 index 0000000000..c91304e897 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-baremetal-options-list-usage.golden @@ -0,0 +1,27 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +List all options matching with filters. + +USAGE: + scw baremetal options list [arg=value ...] + +EXAMPLES: + List all server options in the default zone + scw baremetal options list + + List all server options in fr-par-1 zone + scw baremetal options list zone=fr-par-1 + +ARGS: + [offer-id] Filter options by offer_id + [name] Filter options by name + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | 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-baremetal-options-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-options-usage.golden new file mode 100644 index 0000000000..994c2aacbb --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-baremetal-options-usage.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +A Server has additional options that let you personalize it to better fit your needs. + +USAGE: + scw baremetal options + +AVAILABLE COMMANDS: + add Add server option + delete Delete server option + get Get option + list List options + +FLAGS: + -h, --help help for options + +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 baremetal options [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-baremetal-private-network-add-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-private-network-add-usage.golden index 9e18c77f74..ab5aff89b1 100644 --- a/cmd/scw/testdata/test-all-usage-baremetal-private-network-add-usage.golden +++ b/cmd/scw/testdata/test-all-usage-baremetal-private-network-add-usage.golden @@ -8,7 +8,7 @@ USAGE: ARGS: server-id The ID of the server private-network-id The ID of the private network - [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1) + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2) FLAGS: -h, --help help for add diff --git a/cmd/scw/testdata/test-all-usage-baremetal-private-network-delete-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-private-network-delete-usage.golden index c40171b90f..dff147520d 100644 --- a/cmd/scw/testdata/test-all-usage-baremetal-private-network-delete-usage.golden +++ b/cmd/scw/testdata/test-all-usage-baremetal-private-network-delete-usage.golden @@ -8,7 +8,7 @@ USAGE: ARGS: server-id The ID of the server private-network-id The ID of the private network - [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1) + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2) FLAGS: -h, --help help for delete diff --git a/cmd/scw/testdata/test-all-usage-baremetal-private-network-list-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-private-network-list-usage.golden index c46eb4126c..4cee8c649d 100644 --- a/cmd/scw/testdata/test-all-usage-baremetal-private-network-list-usage.golden +++ b/cmd/scw/testdata/test-all-usage-baremetal-private-network-list-usage.golden @@ -11,7 +11,7 @@ ARGS: [private-network-id] Filter private networks by private network ID [project-id] Filter private networks by project ID [organization-id] Filter private networks by organization ID - [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1) + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2) FLAGS: -h, --help help for list diff --git a/cmd/scw/testdata/test-all-usage-baremetal-private-network-set-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-private-network-set-usage.golden index e9600c11de..3eed231053 100644 --- a/cmd/scw/testdata/test-all-usage-baremetal-private-network-set-usage.golden +++ b/cmd/scw/testdata/test-all-usage-baremetal-private-network-set-usage.golden @@ -8,7 +8,7 @@ USAGE: ARGS: server-id The ID of the server private-network-ids.{index} The IDs of the private networks - [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | nl-ams-1) + [zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-2) FLAGS: -h, --help help for set diff --git a/cmd/scw/testdata/test-all-usage-baremetal-usage.golden b/cmd/scw/testdata/test-all-usage-baremetal-usage.golden index 8c01bf2b62..62d1c20dbe 100644 --- a/cmd/scw/testdata/test-all-usage-baremetal-usage.golden +++ b/cmd/scw/testdata/test-all-usage-baremetal-usage.golden @@ -8,6 +8,7 @@ USAGE: AVAILABLE COMMANDS: bmc Baseboard Management Controller (BMC) management commands offer Server offer management commands + options Server options management commands os Operating System (OS) management commands private-network Private network management command server Server management commands diff --git a/docs/commands/baremetal.md b/docs/commands/baremetal.md index 8a117f6d6d..d24f3f3322 100644 --- a/docs/commands/baremetal.md +++ b/docs/commands/baremetal.md @@ -9,6 +9,11 @@ Elastic metal API - [Server offer management commands](#server-offer-management-commands) - [Get offer](#get-offer) - [List offers](#list-offers) +- [Server options management commands](#server-options-management-commands) + - [Add server option](#add-server-option) + - [Delete server option](#delete-server-option) + - [Get option](#get-option) + - [List options](#list-options) - [Operating System (OS) management commands](#operating-system-(os)-management-commands) - [Get an OS with a given ID](#get-an-os-with-a-given-id) - [List all available OS that can be install on an elastic metal server](#list-all-available-os-that-can-be-install-on-an-elastic-metal-server) @@ -177,6 +182,141 @@ scw baremetal offer list zone=fr-par-1 +## Server options management commands + +A Server has additional options that let you personalize it to better fit your needs. + + + +### Add server option + +Add an option to a specific server. + +**Usage:** + +``` +scw baremetal options add [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| server-id | Required | ID of the server | +| option-id | Required | ID of the option to add | +| expires-at | | Auto expire the option after this date | +| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | + + +**Examples:** + + +Add a given option to a server +``` +scw baremetal options add server-id=11111111-1111-1111-1111-111111111111 option-id=11111111-1111-1111-1111-111111111111 +``` + + + + +### Delete server option + +Delete an option from a specific server. + +**Usage:** + +``` +scw baremetal options delete [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| server-id | Required | ID of the server | +| option-id | Required | ID of the option to delete | +| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | + + +**Examples:** + + +Delete a given option from a server +``` +scw baremetal options delete server-id=11111111-1111-1111-1111-111111111111 option-id=11111111-1111-1111-1111-111111111111 +``` + + + + +### Get option + +Return specific option for the given ID. + +**Usage:** + +``` +scw baremetal options get [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| option-id | Required | ID of the option | +| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | + + +**Examples:** + + +Get a server option with the given ID +``` +scw baremetal options get zone=fr-par-1 option-id=11111111-1111-1111-1111-111111111111 +``` + + + + +### List options + +List all options matching with filters. + +**Usage:** + +``` +scw baremetal options list [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| offer-id | | Filter options by offer_id | +| name | | Filter options by name | +| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | + + +**Examples:** + + +List all server options in the default zone +``` +scw baremetal options list +``` + +List all server options in fr-par-1 zone +``` +scw baremetal options list zone=fr-par-1 +``` + + + + ## Operating System (OS) management commands An Operating System (OS) is the underlying software installed on your server @@ -262,7 +402,7 @@ scw baremetal private-network add [arg=value ...] |------|---|-------------| | server-id | Required | The ID of the server | | private-network-id | Required | The ID of the private network | -| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | +| zone | Default: `fr-par-1`
One of: `fr-par-2` | Zone to target. If none is passed will use default zone from the config | @@ -283,7 +423,7 @@ scw baremetal private-network delete [arg=value ...] |------|---|-------------| | server-id | Required | The ID of the server | | private-network-id | Required | The ID of the private network | -| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | +| zone | Default: `fr-par-1`
One of: `fr-par-2` | Zone to target. If none is passed will use default zone from the config | @@ -307,7 +447,7 @@ scw baremetal private-network list [arg=value ...] | private-network-id | | Filter private networks by private network ID | | project-id | | Filter private networks by project ID | | organization-id | | Filter private networks by organization ID | -| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | +| zone | Default: `fr-par-1`
One of: `fr-par-2` | Zone to target. If none is passed will use default zone from the config | @@ -328,7 +468,7 @@ scw baremetal private-network set [arg=value ...] |------|---|-------------| | server-id | Required | The ID of the server | | private-network-ids.{index} | Required | The IDs of the private networks | -| zone | Default: `fr-par-1`
One of: `fr-par-1`, `fr-par-2`, `nl-ams-1` | Zone to target. If none is passed will use default zone from the config | +| zone | Default: `fr-par-1`
One of: `fr-par-2` | Zone to target. If none is passed will use default zone from the config | diff --git a/go.mod b/go.mod index d7563cca33..6986cb407f 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/kubernetes-client/go-base v0.0.0-20190205182333-3d0e39759d98 github.com/mattn/go-colorable v0.1.13 github.com/mattn/go-isatty v0.0.16 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221117163236-af2cd7649327 + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221130161646-e0f8387f73a0 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.1 diff --git a/go.sum b/go.sum index 5dd89eacf2..67723fd682 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,8 @@ github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221117163236-af2cd7649327 h1:qC5FcsIXIOXoow932RDOV4pvjEKP9KvAbvrtl/ZXZ10= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221117163236-af2cd7649327/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221130161646-e0f8387f73a0 h1:pSsfbPPYDUGIeqhoIzHIMrynJPOXTPwnjiVH6sXfZ8c= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221130161646-e0f8387f73a0/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= diff --git a/internal/namespaces/baremetal/v1/baremetal_cli.go b/internal/namespaces/baremetal/v1/baremetal_cli.go index 6a2df06295..0dd316435c 100644 --- a/internal/namespaces/baremetal/v1/baremetal_cli.go +++ b/internal/namespaces/baremetal/v1/baremetal_cli.go @@ -24,6 +24,7 @@ func GetGeneratedCommands() *core.Commands { baremetalOffer(), baremetalOs(), baremetalBmc(), + baremetalOptions(), baremetalPrivateNetwork(), baremetalServerList(), baremetalServerGet(), @@ -37,8 +38,12 @@ func GetGeneratedCommands() *core.Commands { baremetalBmcStart(), baremetalBmcGet(), baremetalBmcStop(), + baremetalOptionsAdd(), + baremetalOptionsDelete(), baremetalOfferList(), baremetalOfferGet(), + baremetalOptionsGet(), + baremetalOptionsList(), baremetalOsList(), baremetalOsGet(), baremetalPrivateNetworkAdd(), @@ -98,6 +103,16 @@ And finally Get Remote Access to get the login/password https://developers.scale } } +func baremetalOptions() *core.Command { + return &core.Command{ + Short: `Server options management commands`, + Long: `A Server has additional options that let you personalize it to better fit your needs. +`, + Namespace: "baremetal", + Resource: "options", + } +} + func baremetalPrivateNetwork() *core.Command { return &core.Command{ Short: `Private network management command`, @@ -774,6 +789,99 @@ func baremetalBmcStop() *core.Command { } } +func baremetalOptionsAdd() *core.Command { + return &core.Command{ + Short: `Add server option`, + Long: `Add an option to a specific server.`, + Namespace: "baremetal", + Resource: "options", + Verb: "add", + // Deprecated: false, + ArgsType: reflect.TypeOf(baremetal.AddOptionServerRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "server-id", + Short: `ID of the server`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "option-id", + Short: `ID of the option to add`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "expires-at", + Short: `Auto expire the option after this date`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*baremetal.AddOptionServerRequest) + + client := core.ExtractClient(ctx) + api := baremetal.NewAPI(client) + return api.AddOptionServer(request) + + }, + Examples: []*core.Example{ + { + Short: "Add a given option to a server", + ArgsJSON: `{"option_id":"11111111-1111-1111-1111-111111111111","server_id":"11111111-1111-1111-1111-111111111111"}`, + }, + }, + } +} + +func baremetalOptionsDelete() *core.Command { + return &core.Command{ + Short: `Delete server option`, + Long: `Delete an option from a specific server.`, + Namespace: "baremetal", + Resource: "options", + Verb: "delete", + // Deprecated: false, + ArgsType: reflect.TypeOf(baremetal.DeleteOptionServerRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "server-id", + Short: `ID of the server`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "option-id", + Short: `ID of the option to delete`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*baremetal.DeleteOptionServerRequest) + + client := core.ExtractClient(ctx) + api := baremetal.NewAPI(client) + return api.DeleteOptionServer(request) + + }, + Examples: []*core.Example{ + { + Short: "Delete a given option from a server", + ArgsJSON: `{"option_id":"11111111-1111-1111-1111-111111111111","server_id":"11111111-1111-1111-1111-111111111111"}`, + }, + }, + } +} + func baremetalOfferList() *core.Command { return &core.Command{ Short: `List offers`, @@ -855,6 +963,93 @@ func baremetalOfferGet() *core.Command { } } +func baremetalOptionsGet() *core.Command { + return &core.Command{ + Short: `Get option`, + Long: `Return specific option for the given ID.`, + Namespace: "baremetal", + Resource: "options", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(baremetal.GetOptionRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "option-id", + Short: `ID of the option`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*baremetal.GetOptionRequest) + + client := core.ExtractClient(ctx) + api := baremetal.NewAPI(client) + return api.GetOption(request) + + }, + Examples: []*core.Example{ + { + Short: "Get a server option with the given ID", + ArgsJSON: `{"option_id":"11111111-1111-1111-1111-111111111111","zone":"fr-par-1"}`, + }, + }, + } +} + +func baremetalOptionsList() *core.Command { + return &core.Command{ + Short: `List options`, + Long: `List all options matching with filters.`, + Namespace: "baremetal", + Resource: "options", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(baremetal.ListOptionsRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "offer-id", + Short: `Filter options by offer_id`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "name", + Short: `Filter options by name`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*baremetal.ListOptionsRequest) + + client := core.ExtractClient(ctx) + api := baremetal.NewAPI(client) + resp, err := api.ListOptions(request, scw.WithAllPages()) + if err != nil { + return nil, err + } + return resp.Options, nil + + }, + Examples: []*core.Example{ + { + Short: "List all server options in the default zone", + ArgsJSON: `null`, + }, + { + Short: "List all server options in fr-par-1 zone", + ArgsJSON: `{"zone":"fr-par-1"}`, + }, + }, + } +} + func baremetalOsList() *core.Command { return &core.Command{ Short: `List all available OS that can be install on an elastic metal server`, @@ -933,7 +1128,7 @@ func baremetalPrivateNetworkAdd() *core.Command { Resource: "private-network", Verb: "add", // Deprecated: false, - ArgsType: reflect.TypeOf(baremetal.AddServerPrivateNetworkRequest{}), + ArgsType: reflect.TypeOf(baremetal.PrivateNetworkAPIAddServerPrivateNetworkRequest{}), ArgSpecs: core.ArgSpecs{ { Name: "server-id", @@ -949,13 +1144,13 @@ func baremetalPrivateNetworkAdd() *core.Command { Deprecated: false, Positional: false, }, - core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + core.ZoneArgSpec(scw.ZoneFrPar2), }, Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*baremetal.AddServerPrivateNetworkRequest) + request := args.(*baremetal.PrivateNetworkAPIAddServerPrivateNetworkRequest) client := core.ExtractClient(ctx) - api := baremetal.NewAPI(client) + api := baremetal.NewPrivateNetworkAPI(client) return api.AddServerPrivateNetwork(request) }, @@ -970,7 +1165,7 @@ func baremetalPrivateNetworkSet() *core.Command { Resource: "private-network", Verb: "set", // Deprecated: false, - ArgsType: reflect.TypeOf(baremetal.SetServerPrivateNetworksRequest{}), + ArgsType: reflect.TypeOf(baremetal.PrivateNetworkAPISetServerPrivateNetworksRequest{}), ArgSpecs: core.ArgSpecs{ { Name: "server-id", @@ -986,13 +1181,13 @@ func baremetalPrivateNetworkSet() *core.Command { Deprecated: false, Positional: false, }, - core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + core.ZoneArgSpec(scw.ZoneFrPar2), }, Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*baremetal.SetServerPrivateNetworksRequest) + request := args.(*baremetal.PrivateNetworkAPISetServerPrivateNetworksRequest) client := core.ExtractClient(ctx) - api := baremetal.NewAPI(client) + api := baremetal.NewPrivateNetworkAPI(client) return api.SetServerPrivateNetworks(request) }, @@ -1007,7 +1202,7 @@ func baremetalPrivateNetworkList() *core.Command { Resource: "private-network", Verb: "list", // Deprecated: false, - ArgsType: reflect.TypeOf(baremetal.ListServerPrivateNetworksRequest{}), + ArgsType: reflect.TypeOf(baremetal.PrivateNetworkAPIListServerPrivateNetworksRequest{}), ArgSpecs: core.ArgSpecs{ { Name: "order-by", @@ -1045,13 +1240,13 @@ func baremetalPrivateNetworkList() *core.Command { Deprecated: false, Positional: false, }, - core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + core.ZoneArgSpec(scw.ZoneFrPar2), }, Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*baremetal.ListServerPrivateNetworksRequest) + request := args.(*baremetal.PrivateNetworkAPIListServerPrivateNetworksRequest) client := core.ExtractClient(ctx) - api := baremetal.NewAPI(client) + api := baremetal.NewPrivateNetworkAPI(client) resp, err := api.ListServerPrivateNetworks(request, scw.WithAllPages()) if err != nil { return nil, err @@ -1070,7 +1265,7 @@ func baremetalPrivateNetworkDelete() *core.Command { Resource: "private-network", Verb: "delete", // Deprecated: false, - ArgsType: reflect.TypeOf(baremetal.DeleteServerPrivateNetworkRequest{}), + ArgsType: reflect.TypeOf(baremetal.PrivateNetworkAPIDeleteServerPrivateNetworkRequest{}), ArgSpecs: core.ArgSpecs{ { Name: "server-id", @@ -1086,13 +1281,13 @@ func baremetalPrivateNetworkDelete() *core.Command { Deprecated: false, Positional: false, }, - core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1), + core.ZoneArgSpec(scw.ZoneFrPar2), }, Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { - request := args.(*baremetal.DeleteServerPrivateNetworkRequest) + request := args.(*baremetal.PrivateNetworkAPIDeleteServerPrivateNetworkRequest) client := core.ExtractClient(ctx) - api := baremetal.NewAPI(client) + api := baremetal.NewPrivateNetworkAPI(client) e = api.DeleteServerPrivateNetwork(request) if e != nil { return nil, e diff --git a/internal/namespaces/lb/v1/testdata/test-get-backend-simple.golden b/internal/namespaces/lb/v1/testdata/test-get-backend-simple.golden index 4a762a5247..06d6aec90b 100644 --- a/internal/namespaces/lb/v1/testdata/test-get-backend-simple.golden +++ b/internal/namespaces/lb/v1/testdata/test-get-backend-simple.golden @@ -119,6 +119,7 @@ ID STATUS IP ADDRESS CREATED AT UPDA "updated_at": "1970-01-01T00:00:00.0Z", "failover_host": null, "ssl_bridging": false, + "ignore_ssl_server_verify": null, "timeout_server": null, "timeout_connect": null, "timeout_tunnel": null diff --git a/internal/namespaces/lb/v1/testdata/test-get-frontend-simple.golden b/internal/namespaces/lb/v1/testdata/test-get-frontend-simple.golden index 95c8d59ba8..43b9c08291 100644 --- a/internal/namespaces/lb/v1/testdata/test-get-frontend-simple.golden +++ b/internal/namespaces/lb/v1/testdata/test-get-frontend-simple.golden @@ -5,6 +5,7 @@ Name cli-test InboundPort 8888 CreatedAt few seconds ago UpdatedAt few seconds ago +EnableHTTP3 false Lb: ID 15a8cc98-21b4-422b-a6e0-b9a942365122 @@ -142,6 +143,7 @@ ID STATUS IP ADDRESS CREATED AT UPDATED AT REGION ZONE "updated_at": "1970-01-01T00:00:00.0Z", "failover_host": null, "ssl_bridging": false, + "ignore_ssl_server_verify": null, "timeout_server": null, "timeout_connect": null, "timeout_tunnel": null @@ -182,5 +184,6 @@ ID STATUS IP ADDRESS CREATED AT UPDATED AT REGION ZONE "certificate_ids": [], "created_at": "1970-01-01T00:00:00.0Z", "updated_at": "1970-01-01T00:00:00.0Z", + "enable_http3": false, "timeout_client": null }