From cda56f767a9eeaed3e2aa089c1a698847e905e61 Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 23 Mar 2023 10:51:03 +0000 Subject: [PATCH] feat: update generated APIs --- ...sage-marketplace-category-get-usage.golden | 18 ++ ...age-marketplace-category-list-usage.golden | 15 ++ ...ll-usage-marketplace-category-usage.golden | 21 ++ ...e-marketplace-local-image-get-usage.golden | 18 ++ ...usage-marketplace-local-image-usage.golden | 1 + .../test-all-usage-marketplace-usage.golden | 2 + ...usage-marketplace-version-get-usage.golden | 18 ++ ...sage-marketplace-version-list-usage.golden | 19 ++ ...all-usage-marketplace-version-usage.golden | 21 ++ .../test-all-usage-rdb-acl-set-usage.golden | 21 ++ .../test-all-usage-rdb-acl-usage.golden | 1 + ...all-usage-rdb-endpoint-create-usage.golden | 21 ++ ...all-usage-rdb-endpoint-delete-usage.golden | 19 ++ ...st-all-usage-rdb-endpoint-get-usage.golden | 19 ++ ...ll-usage-rdb-endpoint-migrate-usage.golden | 20 ++ .../test-all-usage-rdb-endpoint-usage.golden | 29 +++ ...sage-rdb-instance-get-metrics-usage.golden | 22 ++ .../test-all-usage-rdb-instance-usage.golden | 1 + ...est-all-usage-rdb-setting-add-usage.golden | 21 ++ ...-all-usage-rdb-setting-delete-usage.golden | 20 ++ ...est-all-usage-rdb-setting-set-usage.golden | 21 ++ .../test-all-usage-rdb-setting-usage.golden | 26 ++ .../testdata/test-all-usage-rdb-usage.golden | 2 + docs/commands/marketplace.md | 106 ++++++++ docs/commands/rdb.md | 226 ++++++++++++++++++ go.mod | 2 +- go.sum | 4 +- .../marketplace/v2/marketplace_cli.go | 175 ++++++++++++++ 28 files changed, 886 insertions(+), 3 deletions(-) create mode 100644 cmd/scw/testdata/test-all-usage-marketplace-category-get-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-marketplace-category-list-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-marketplace-category-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-marketplace-local-image-get-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-marketplace-version-get-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-marketplace-version-list-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-marketplace-version-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-acl-set-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-endpoint-create-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-endpoint-delete-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-endpoint-get-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-endpoint-migrate-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-endpoint-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-instance-get-metrics-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-setting-add-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-setting-delete-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-setting-set-usage.golden create mode 100644 cmd/scw/testdata/test-all-usage-rdb-setting-usage.golden diff --git a/cmd/scw/testdata/test-all-usage-marketplace-category-get-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-category-get-usage.golden new file mode 100644 index 0000000000..11f6ab84a3 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-marketplace-category-get-usage.golden @@ -0,0 +1,18 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get marketplace resources. + +USAGE: + scw marketplace category get [arg=value ...] + +ARGS: + category-id + +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-marketplace-category-list-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-category-list-usage.golden new file mode 100644 index 0000000000..ac4905564e --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-marketplace-category-list-usage.golden @@ -0,0 +1,15 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +List marketplace resources. + +USAGE: + scw marketplace category list + +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-marketplace-category-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-category-usage.golden new file mode 100644 index 0000000000..1703d430f6 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-marketplace-category-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Marketplace category management commands. + +USAGE: + scw marketplace category + +AVAILABLE COMMANDS: + get Get marketplace resources + list List marketplace resources + +FLAGS: + -h, --help help for category + +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 marketplace category [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-marketplace-local-image-get-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-local-image-get-usage.golden new file mode 100644 index 0000000000..898a3563f9 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-marketplace-local-image-get-usage.golden @@ -0,0 +1,18 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get marketplace resources. + +USAGE: + scw marketplace local-image get [arg=value ...] + +ARGS: + local-image-id + +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-marketplace-local-image-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-local-image-usage.golden index 546e678c9f..58684ab19d 100644 --- a/cmd/scw/testdata/test-all-usage-marketplace-local-image-usage.golden +++ b/cmd/scw/testdata/test-all-usage-marketplace-local-image-usage.golden @@ -6,6 +6,7 @@ USAGE: scw marketplace local-image AVAILABLE COMMANDS: + get Get marketplace resources list List local images from a specific image or version FLAGS: diff --git a/cmd/scw/testdata/test-all-usage-marketplace-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-usage.golden index df21e4fdea..18ec6b6da1 100644 --- a/cmd/scw/testdata/test-all-usage-marketplace-usage.golden +++ b/cmd/scw/testdata/test-all-usage-marketplace-usage.golden @@ -6,8 +6,10 @@ USAGE: scw marketplace AVAILABLE COMMANDS: + category Marketplace category management commands image Marketplace images management commands local-image Marketplace Local Images management commands + version Marketplace version management commands FLAGS: -h, --help help for marketplace diff --git a/cmd/scw/testdata/test-all-usage-marketplace-version-get-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-version-get-usage.golden new file mode 100644 index 0000000000..19fcb21171 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-marketplace-version-get-usage.golden @@ -0,0 +1,18 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Get marketplace resources. + +USAGE: + scw marketplace version get [arg=value ...] + +ARGS: + version-id + +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-marketplace-version-list-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-version-list-usage.golden new file mode 100644 index 0000000000..28c02d1987 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-marketplace-version-list-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +List marketplace resources. + +USAGE: + scw marketplace version list [arg=value ...] + +ARGS: + [image-id] + [order-by] (created_at_asc | created_at_desc) + +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-marketplace-version-usage.golden b/cmd/scw/testdata/test-all-usage-marketplace-version-usage.golden new file mode 100644 index 0000000000..e6afa2c1c6 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-marketplace-version-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Marketplace version management commands. + +USAGE: + scw marketplace version + +AVAILABLE COMMANDS: + get Get marketplace resources + list List marketplace resources + +FLAGS: + -h, --help help for version + +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 marketplace version [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-rdb-acl-set-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-acl-set-usage.golden new file mode 100644 index 0000000000..a79fdd1966 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-acl-set-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Replace all the ACL rules of a Database Instance. + +USAGE: + scw rdb acl set [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance where the ACL rules must be set + [rules.{index}.ip] + [rules.{index}.description] + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for set + +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-rdb-acl-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-acl-usage.golden index 635afe00f6..3fac5f0405 100644 --- a/cmd/scw/testdata/test-all-usage-rdb-acl-usage.golden +++ b/cmd/scw/testdata/test-all-usage-rdb-acl-usage.golden @@ -9,6 +9,7 @@ AVAILABLE COMMANDS: add Add an ACL rule to a Database Instance delete Delete ACL rules of a Database Instance list List ACL rules of a Database Instance + set Set ACL rules for a Database Instance FLAGS: -h, --help help for acl diff --git a/cmd/scw/testdata/test-all-usage-rdb-endpoint-create-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-endpoint-create-usage.golden new file mode 100644 index 0000000000..b9a0ccef16 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-endpoint-create-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Create a new endpoint for a Database Instance. You can add `load_balancer` and `private_network` specifications to the body of the request. Note that this action replaces your current endpoint, which means you might need to update any environment configurations that point to the old endpoint. + +USAGE: + scw rdb endpoint create [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance you to which you want to add an endpoint + [endpoint-spec.private-network.private-network-id] UUID of the Private Network to be connected to the Database Instance + [endpoint-spec.private-network.service-ip] Endpoint IPv4 address with a CIDR notation. Refer to the official Scaleway documentation to learn more about IP and subnet limitations. + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +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-rdb-endpoint-delete-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-endpoint-delete-usage.golden new file mode 100644 index 0000000000..5708af3aff --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-endpoint-delete-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete the endpoint of a Database Instance. You must specify the `region` and `endpoint_id` parameters of the endpoint you want to delete. Note that might need to update any environment configurations that point to the deleted endpoint. + +USAGE: + scw rdb endpoint delete [arg=value ...] + +ARGS: + endpoint-id UUID of the endpoint you want to delete + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +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-rdb-endpoint-get-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-endpoint-get-usage.golden new file mode 100644 index 0000000000..6051e7632d --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-endpoint-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve information about a Database Instance endpoint. Full details about the endpoint, like `ip`, `port`, `private_network` and `load_balancer` specifications are returned in the response. + +USAGE: + scw rdb endpoint get [arg=value ...] + +ARGS: + endpoint-id UUID of the endpoint you want to get + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +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-rdb-endpoint-migrate-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-endpoint-migrate-usage.golden new file mode 100644 index 0000000000..5cb1774136 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-endpoint-migrate-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Migrate an existing instance endpoint to another instance. + +USAGE: + scw rdb endpoint migrate [arg=value ...] + +ARGS: + endpoint-id UUID of the endpoint you want to migrate + instance-id UUID of the instance you want to attach the endpoint to + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for migrate + +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-rdb-endpoint-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-endpoint-usage.golden new file mode 100644 index 0000000000..2918a20545 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-endpoint-usage.golden @@ -0,0 +1,29 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +A point of connection to a Database Instance. The endpoint is associated with an IPv4 address and a port. It contains the information about whether the endpoint is read-write or not. The endpoints always point to the main node of a Database Instance. + +All endpoints have TLS enabled. You can use TLS to make your data and your passwords unreadable in transit to anyone but you. + +For added security, you can set up ACL rules to restrict access to your endpoint to a set of trusted hosts or networks of your choice. + +Load Balancers are used to forward traffic to the right node based on the node state (active/hot standby). The Load Balancers' configuration is set to cut off inactive connections if no TCP traffic is sent within a 6-hour timeframe. We recommend using connection pooling on the application side to renew database connections regularly. + +USAGE: + scw rdb endpoint + +AVAILABLE COMMANDS: + create Create a new Database Instance endpoint + delete Delete a Database Instance endpoint + get Get a Database Instance endpoint + migrate Migrate an existing instance endpoint to another instance + +FLAGS: + -h, --help help for endpoint + +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 rdb endpoint [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-rdb-instance-get-metrics-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-instance-get-metrics-usage.golden new file mode 100644 index 0000000000..8349256c3d --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-instance-get-metrics-usage.golden @@ -0,0 +1,22 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Retrieve the time series metrics of a given Database Instance. You can define the period from which to retrieve metrics by specifying the `start_date` and `end_date`. + +USAGE: + scw rdb instance get-metrics [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance + [start-date] Start date to gather metrics from + [end-date] End date to gather metrics from + [metric-name] Name of the metric to gather + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for get-metrics + +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-rdb-instance-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-instance-usage.golden index be1128e0fd..36058d5814 100644 --- a/cmd/scw/testdata/test-all-usage-rdb-instance-usage.golden +++ b/cmd/scw/testdata/test-all-usage-rdb-instance-usage.golden @@ -16,6 +16,7 @@ AVAILABLE COMMANDS: delete Delete a Database Instance get Get a Database Instance get-certificate Get the TLS certificate of a Database Instance + get-metrics Get Database Instance metrics list List Database Instances renew-certificate Renew the TLS certificate of a Database Instance restart Restart Database Instance diff --git a/cmd/scw/testdata/test-all-usage-rdb-setting-add-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-setting-add-usage.golden new file mode 100644 index 0000000000..f4fceba6c0 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-setting-add-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Add an advanced setting to a Database Instance. You must set the `name` and the `value` of each setting. + +USAGE: + scw rdb setting add [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance you want to add settings to + [settings.{index}.name] + [settings.{index}.value] + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +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-rdb-setting-delete-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-setting-delete-usage.golden new file mode 100644 index 0000000000..f5252bd43f --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-setting-delete-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Delete an advanced setting in a Database Instance. You must specify the names of the settings you want to delete in the request. + +USAGE: + scw rdb setting delete [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance to delete settings from + setting-names.{index} Settings names to delete + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +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-rdb-setting-set-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-setting-set-usage.golden new file mode 100644 index 0000000000..d887481402 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-setting-set-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Update an advanced setting for a Database Instance. Settings added upon database engine initalization can only be defined once, and cannot, therefore, be updated. + +USAGE: + scw rdb setting set [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance where the settings must be set + [settings.{index}.name] + [settings.{index}.value] + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw) + +FLAGS: + -h, --help help for set + +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-rdb-setting-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-setting-usage.golden new file mode 100644 index 0000000000..9c61fd618f --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-rdb-setting-usage.golden @@ -0,0 +1,26 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +πŸŸ₯πŸŸ₯πŸŸ₯ STDERR️️ πŸŸ₯πŸŸ₯πŸŸ₯️ +Advanced Database Instance settings allow you to tune the behavior of your database engines to better fit your needs. + +Available settings depend on the database engine and its version. Note that some settings can only be defined upon database engine initialization. These are called init settings. You can find a full list of the settings available in the response body of the [list available database engines](https://developers.scaleway.com/en/products/rdb/api/#get-1eafb7) endpoint. + +Each advanced setting entry has a default value that users can override. The deletion of a setting entry will restore the setting to default value. Some of the defaults values can be different from the engine's defaults, as we optimize them to the Scaleway platform. + +USAGE: + scw rdb setting + +AVAILABLE COMMANDS: + add Add Database Instance advanced settings + delete Delete Database Instance advanced settings + set Set Database Instance advanced settings + +FLAGS: + -h, --help help for setting + +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 rdb setting [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-rdb-usage.golden b/cmd/scw/testdata/test-all-usage-rdb-usage.golden index 8ff15acb1a..221a18b598 100644 --- a/cmd/scw/testdata/test-all-usage-rdb-usage.golden +++ b/cmd/scw/testdata/test-all-usage-rdb-usage.golden @@ -9,12 +9,14 @@ AVAILABLE COMMANDS: acl Access Control List (ACL) management commands backup Backup management commands database Database management commands + endpoint Endpoint management engine Database engines commands instance Instance management commands log Instance logs management commands node-type Node types management commands privilege User privileges management commands read-replica Read replica management + setting Setting management snapshot Block snapshot management user User management commands diff --git a/docs/commands/marketplace.md b/docs/commands/marketplace.md index 74b2f8e8b1..b094903ee0 100644 --- a/docs/commands/marketplace.md +++ b/docs/commands/marketplace.md @@ -2,13 +2,56 @@ # Documentation for `scw marketplace` Marketplace API. +- [Marketplace category management commands](#marketplace-category-management-commands) + - [Get marketplace resources](#get-marketplace-resources) + - [List marketplace resources](#list-marketplace-resources) - [Marketplace images management commands](#marketplace-images-management-commands) - [Get a specific marketplace image](#get-a-specific-marketplace-image) - [List marketplace images](#list-marketplace-images) - [Marketplace Local Images management commands](#marketplace-local-images-management-commands) + - [Get marketplace resources](#get-marketplace-resources) - [List local images from a specific image or version](#list-local-images-from-a-specific-image-or-version) +- [Marketplace version management commands](#marketplace-version-management-commands) + - [Get marketplace resources](#get-marketplace-resources) + - [List marketplace resources](#list-marketplace-resources) +## Marketplace category management commands + +Marketplace category management commands. + + +### Get marketplace resources + +Get marketplace resources. + +**Usage:** + +``` +scw marketplace category get [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| category-id | Required | | + + + +### List marketplace resources + +List marketplace resources. + +**Usage:** + +``` +scw marketplace category list +``` + + + ## Marketplace images management commands Marketplace images management commands. @@ -60,6 +103,25 @@ scw marketplace image list [arg=value ...] Marketplace Local Images management commands. +### Get marketplace resources + +Get marketplace resources. + +**Usage:** + +``` +scw marketplace local-image get [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| local-image-id | Required | | + + + ### List local images from a specific image or version List local images from a specific image or version. @@ -83,3 +145,47 @@ scw marketplace local-image list [arg=value ...] +## Marketplace version management commands + +Marketplace version management commands. + + +### Get marketplace resources + +Get marketplace resources. + +**Usage:** + +``` +scw marketplace version get [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| version-id | Required | | + + + +### List marketplace resources + +List marketplace resources. + +**Usage:** + +``` +scw marketplace version list [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| image-id | | | +| order-by | One of: `created_at_asc`, `created_at_desc` | | + + + diff --git a/docs/commands/rdb.md b/docs/commands/rdb.md index ef24ae6626..dc25e4425b 100644 --- a/docs/commands/rdb.md +++ b/docs/commands/rdb.md @@ -6,6 +6,7 @@ Managed Database for PostgreSQL and MySQL API. - [Add an ACL rule to a Database Instance](#add-an-acl-rule-to-a-database-instance) - [Delete ACL rules of a Database Instance](#delete-acl-rules-of-a-database-instance) - [List ACL rules of a Database Instance](#list-acl-rules-of-a-database-instance) + - [Set ACL rules for a Database Instance](#set-acl-rules-for-a-database-instance) - [Backup management commands](#backup-management-commands) - [Create a database backup](#create-a-database-backup) - [Delete a database backup](#delete-a-database-backup) @@ -20,6 +21,11 @@ Managed Database for PostgreSQL and MySQL API. - [Create a database in a Database Instance](#create-a-database-in-a-database-instance) - [Delete a database in a Database Instance](#delete-a-database-in-a-database-instance) - [List databases in a Database Instance](#list-databases-in-a-database-instance) +- [Endpoint management](#endpoint-management) + - [Create a new Database Instance endpoint](#create-a-new-database-instance-endpoint) + - [Delete a Database Instance endpoint](#delete-a-database-instance-endpoint) + - [Get a Database Instance endpoint](#get-a-database-instance-endpoint) + - [Migrate an existing instance endpoint to another instance](#migrate-an-existing-instance-endpoint-to-another-instance) - [Database engines commands](#database-engines-commands) - [List available database engines](#list-available-database-engines) - [List available settings from an engine.](#list-available-settings-from-an-engine.) @@ -30,6 +36,7 @@ Managed Database for PostgreSQL and MySQL API. - [Delete a Database Instance](#delete-a-database-instance) - [Get a Database Instance](#get-a-database-instance) - [Get the TLS certificate of a Database Instance](#get-the-tls-certificate-of-a-database-instance) + - [Get Database Instance metrics](#get-database-instance-metrics) - [List Database Instances](#list-database-instances) - [Renew the TLS certificate of a Database Instance](#renew-the-tls-certificate-of-a-database-instance) - [Restart Database Instance](#restart-database-instance) @@ -53,6 +60,10 @@ Managed Database for PostgreSQL and MySQL API. - [Delete a Read Replica](#delete-a-read-replica) - [Get a Read Replica](#get-a-read-replica) - [Resync a Read Replica](#resync-a-read-replica) +- [Setting management](#setting-management) + - [Add Database Instance advanced settings](#add-database-instance-advanced-settings) + - [Delete Database Instance advanced settings](#delete-database-instance-advanced-settings) + - [Set Database Instance advanced settings](#set-database-instance-advanced-settings) - [Block snapshot management](#block-snapshot-management) - [Create a Database Instance snapshot](#create-a-database-instance-snapshot) - [Delete a Database Instance snapshot](#delete-a-database-instance-snapshot) @@ -136,6 +147,28 @@ scw rdb acl list [arg=value ...] +### Set ACL rules for a Database Instance + +Replace all the ACL rules of a Database Instance. + +**Usage:** + +``` +scw rdb acl set [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| instance-id | Required | UUID of the Database Instance where the ACL rules must be set | +| rules.{index}.ip | | | +| rules.{index}.description | | | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + ## Backup management commands A database backup is a dated export of a Database Instance stored on an offsite backend located in a different region than your database, by default. Once a backup is created, it can be used to restore the database. Each logical database in a Database Instance is backed up and can be restored separately. @@ -426,6 +459,101 @@ scw rdb database list [arg=value ...] +## Endpoint management + +A point of connection to a Database Instance. The endpoint is associated with an IPv4 address and a port. It contains the information about whether the endpoint is read-write or not. The endpoints always point to the main node of a Database Instance. + +All endpoints have TLS enabled. You can use TLS to make your data and your passwords unreadable in transit to anyone but you. + +For added security, you can set up ACL rules to restrict access to your endpoint to a set of trusted hosts or networks of your choice. + +Load Balancers are used to forward traffic to the right node based on the node state (active/hot standby). The Load Balancers' configuration is set to cut off inactive connections if no TCP traffic is sent within a 6-hour timeframe. We recommend using connection pooling on the application side to renew database connections regularly. + + + +### Create a new Database Instance endpoint + +Create a new endpoint for a Database Instance. You can add `load_balancer` and `private_network` specifications to the body of the request. Note that this action replaces your current endpoint, which means you might need to update any environment configurations that point to the old endpoint. + +**Usage:** + +``` +scw rdb endpoint create [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| instance-id | Required | UUID of the Database Instance you to which you want to add an endpoint | +| endpoint-spec.private-network.private-network-id | | UUID of the Private Network to be connected to the Database Instance | +| endpoint-spec.private-network.service-ip | | Endpoint IPv4 address with a CIDR notation. Refer to the official Scaleway documentation to learn more about IP and subnet limitations. | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + +### Delete a Database Instance endpoint + +Delete the endpoint of a Database Instance. You must specify the `region` and `endpoint_id` parameters of the endpoint you want to delete. Note that might need to update any environment configurations that point to the deleted endpoint. + +**Usage:** + +``` +scw rdb endpoint delete [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| endpoint-id | Required | UUID of the endpoint you want to delete | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + +### Get a Database Instance endpoint + +Retrieve information about a Database Instance endpoint. Full details about the endpoint, like `ip`, `port`, `private_network` and `load_balancer` specifications are returned in the response. + +**Usage:** + +``` +scw rdb endpoint get [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| endpoint-id | Required | UUID of the endpoint you want to get | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + +### Migrate an existing instance endpoint to another instance + +Migrate an existing instance endpoint to another instance. + +**Usage:** + +``` +scw rdb endpoint migrate [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| endpoint-id | Required | UUID of the endpoint you want to migrate | +| instance-id | Required | UUID of the instance you want to attach the endpoint to | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + ## Database engines commands A database engine is the software component that stores and retrieves your data from a database. Currently PostgreSQL 11, 12, 13 and 14 are available. MySQL is available in version 8. @@ -635,6 +763,29 @@ scw rdb instance get-certificate [arg=value ...] +### Get Database Instance metrics + +Retrieve the time series metrics of a given Database Instance. You can define the period from which to retrieve metrics by specifying the `start_date` and `end_date`. + +**Usage:** + +``` +scw rdb instance get-metrics [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| instance-id | Required | UUID of the Database Instance | +| start-date | | Start date to gather metrics from | +| end-date | | End date to gather metrics from | +| metric-name | | Name of the metric to gather | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + ### List Database Instances List all Database Instances in the specified region, for a given Scaleway Organization or Scaleway Project. By default, the Database Instances returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `tags` and `name`. For the `name` parameter, the value you include will be checked against the whole name string to see if it includes the string you put in the parameter. @@ -1124,6 +1275,81 @@ scw rdb read-replica reset [arg=value ...] +## Setting management + +Advanced Database Instance settings allow you to tune the behavior of your database engines to better fit your needs. + +Available settings depend on the database engine and its version. Note that some settings can only be defined upon database engine initialization. These are called init settings. You can find a full list of the settings available in the response body of the [list available database engines](https://developers.scaleway.com/en/products/rdb/api/#get-1eafb7) endpoint. + +Each advanced setting entry has a default value that users can override. The deletion of a setting entry will restore the setting to default value. Some of the defaults values can be different from the engine's defaults, as we optimize them to the Scaleway platform. + + + +### Add Database Instance advanced settings + +Add an advanced setting to a Database Instance. You must set the `name` and the `value` of each setting. + +**Usage:** + +``` +scw rdb setting add [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| instance-id | Required | UUID of the Database Instance you want to add settings to | +| settings.{index}.name | | | +| settings.{index}.value | | | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + +### Delete Database Instance advanced settings + +Delete an advanced setting in a Database Instance. You must specify the names of the settings you want to delete in the request. + +**Usage:** + +``` +scw rdb setting delete [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| instance-id | Required | UUID of the Database Instance to delete settings from | +| setting-names.{index} | Required | Settings names to delete | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + +### Set Database Instance advanced settings + +Update an advanced setting for a Database Instance. Settings added upon database engine initalization can only be defined once, and cannot, therefore, be updated. + +**Usage:** + +``` +scw rdb setting set [arg=value ...] +``` + + +**Args:** + +| Name | | Description | +|------|---|-------------| +| instance-id | Required | UUID of the Database Instance where the settings must be set | +| settings.{index}.name | | | +| settings.{index}.value | | | +| region | Default: `fr-par`
One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config | + + + ## Block snapshot management A snapshot is a consistent, instantaneous copy of the Block Storage volume of your Database Instance at a certain point in time. They are designed to recover your data in case of failure or accidental alterations of the data by a user. They allow you to quickly create a new Instance from a previous state of your database, regardless of the size of the volume. Their limitation is that, unlike backups, snapshots can only be stored in the same location as the original data. diff --git a/go.mod b/go.mod index 5d378a0fd5..d165d5249b 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/moby/buildkit v0.11.4 github.com/opencontainers/go-digest v1.0.0 github.com/pkg/errors v0.9.1 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322175238-aa881483e689 + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230323101524-c017498bf616 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.2 diff --git a/go.sum b/go.sum index 37c942ffc0..dfeb00a174 100644 --- a/go.sum +++ b/go.sum @@ -192,8 +192,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322175238-aa881483e689 h1:QPpApIAOwB3/9ZPu+SOu5bjoN7keDalTCpyCf2VYx4w= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230322175238-aa881483e689/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230323101524-c017498bf616 h1:7zcfy2f51uoLQyFzguQXa5rxDzyy8md6eWTuwFn3sis= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230323101524-c017498bf616/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg= github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE= 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= diff --git a/internal/namespaces/marketplace/v2/marketplace_cli.go b/internal/namespaces/marketplace/v2/marketplace_cli.go index bda4d6ce00..a8bbd77fc4 100644 --- a/internal/namespaces/marketplace/v2/marketplace_cli.go +++ b/internal/namespaces/marketplace/v2/marketplace_cli.go @@ -22,9 +22,16 @@ func GetGeneratedCommands() *core.Commands { marketplaceRoot(), marketplaceImage(), marketplaceLocalImage(), + marketplaceVersion(), + marketplaceCategory(), marketplaceImageList(), marketplaceImageGet(), + marketplaceVersionList(), + marketplaceVersionGet(), marketplaceLocalImageList(), + marketplaceLocalImageGet(), + marketplaceCategoryList(), + marketplaceCategoryGet(), ) } func marketplaceRoot() *core.Command { @@ -53,6 +60,24 @@ func marketplaceLocalImage() *core.Command { } } +func marketplaceVersion() *core.Command { + return &core.Command{ + Short: `Marketplace version management commands`, + Long: `Marketplace version management commands.`, + Namespace: "marketplace", + Resource: "version", + } +} + +func marketplaceCategory() *core.Command { + return &core.Command{ + Short: `Marketplace category management commands`, + Long: `Marketplace category management commands.`, + Namespace: "marketplace", + Resource: "category", + } +} + func marketplaceImageList() *core.Command { return &core.Command{ Short: `List marketplace images`, @@ -173,6 +198,74 @@ func marketplaceImageGet() *core.Command { } } +func marketplaceVersionList() *core.Command { + return &core.Command{ + Short: `List marketplace resources`, + Long: `List marketplace resources.`, + Namespace: "marketplace", + Resource: "version", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(marketplace.ListVersionsRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "image-id", + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "order-by", + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"created_at_asc", "created_at_desc"}, + }, + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*marketplace.ListVersionsRequest) + + client := core.ExtractClient(ctx) + api := marketplace.NewAPI(client) + opts := []scw.RequestOption{scw.WithAllPages()} + resp, err := api.ListVersions(request, opts...) + if err != nil { + return nil, err + } + return resp.Versions, nil + + }, + } +} + +func marketplaceVersionGet() *core.Command { + return &core.Command{ + Short: `Get marketplace resources`, + Long: `Get marketplace resources.`, + Namespace: "marketplace", + Resource: "version", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(marketplace.GetVersionRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "version-id", + Required: true, + Deprecated: false, + Positional: false, + }, + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*marketplace.GetVersionRequest) + + client := core.ExtractClient(ctx) + api := marketplace.NewAPI(client) + return api.GetVersion(request) + + }, + } +} + func marketplaceLocalImageList() *core.Command { return &core.Command{ Short: `List local images from a specific image or version`, @@ -230,3 +323,85 @@ func marketplaceLocalImageList() *core.Command { }, } } + +func marketplaceLocalImageGet() *core.Command { + return &core.Command{ + Short: `Get marketplace resources`, + Long: `Get marketplace resources.`, + Namespace: "marketplace", + Resource: "local-image", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(marketplace.GetLocalImageRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "local-image-id", + Required: true, + Deprecated: false, + Positional: false, + }, + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*marketplace.GetLocalImageRequest) + + client := core.ExtractClient(ctx) + api := marketplace.NewAPI(client) + return api.GetLocalImage(request) + + }, + } +} + +func marketplaceCategoryList() *core.Command { + return &core.Command{ + Short: `List marketplace resources`, + Long: `List marketplace resources.`, + Namespace: "marketplace", + Resource: "category", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(marketplace.ListCategoriesRequest{}), + ArgSpecs: core.ArgSpecs{}, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*marketplace.ListCategoriesRequest) + + client := core.ExtractClient(ctx) + api := marketplace.NewAPI(client) + opts := []scw.RequestOption{scw.WithAllPages()} + resp, err := api.ListCategories(request, opts...) + if err != nil { + return nil, err + } + return resp.Categories, nil + + }, + } +} + +func marketplaceCategoryGet() *core.Command { + return &core.Command{ + Short: `Get marketplace resources`, + Long: `Get marketplace resources.`, + Namespace: "marketplace", + Resource: "category", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(marketplace.GetCategoryRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "category-id", + Required: true, + Deprecated: false, + Positional: false, + }, + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*marketplace.GetCategoryRequest) + + client := core.ExtractClient(ctx) + api := marketplace.NewAPI(client) + return api.GetCategory(request) + + }, + } +}