diff --git a/cmd/scw/testdata/test-all-usage-mongodb-instance-create-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-instance-create-usage.golden new file mode 100644 index 0000000000..9bfb029f36 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-instance-create-usage.golden @@ -0,0 +1,29 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Create a new MongoDB™ Database Instance. + +USAGE: + scw mongodb instance create [arg=value ...] + +ARGS: + [project-id] Project ID to use. If none is passed the default project ID will be used + [name] Name of the Database Instance + version Version of the MongoDB™ engine + [tags.{index}] Tags to apply to the Database Instance + node-number Number of node to use for the Database Instance + node-type Type of node to use for the Database Instance + user-name Username created when the Database Instance is created + password Password of the initial user + [volume.volume-size] Volume size + [volume.volume-type] Type of volume where data is stored (unknown_type | sbs_5k | sbs_15k) + [endpoints.{index}.private-network.private-network-id] UUID of the private network + [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-mongodb-instance-delete-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-instance-delete-usage.golden new file mode 100644 index 0000000000..2b84f8f8e7 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-instance-delete-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Delete a given MongoDB™ Database Instance, specified by the `region` and `instance_id` parameters. Deleting a MongoDB™ Database Instance is permanent, and cannot be undone. Note that upon deletion all your data will be lost. + +USAGE: + scw mongodb instance delete [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance 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-mongodb-instance-get-certificate-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-instance-get-certificate-usage.golden new file mode 100644 index 0000000000..4f126379d3 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-instance-get-certificate-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Retrieve the certificate of a given Database Instance, specified by the `instance_id` parameter. + +USAGE: + scw mongodb instance get-certificate [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance + [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-certificate + +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-mongodb-instance-get-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-instance-get-usage.golden new file mode 100644 index 0000000000..15dbd0b416 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-instance-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Retrieve information about a given MongoDB™ Database Instance, specified by the `region` and `instance_id` parameters. Its full details, including name, status, IP address and port, are returned in the response object. + +USAGE: + scw mongodb instance get [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance + [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-mongodb-instance-list-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-instance-list-usage.golden new file mode 100644 index 0000000000..4867dc6cf5 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-instance-list-usage.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +List all MongoDB™ Database Instances in the specified region, for a given Scaleway Project. By default, the MongoDB™ 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. + +USAGE: + scw mongodb instance list [arg=value ...] + +ARGS: + [tags.{index}] List Database Instances that have a given tag + [name] Lists Database Instances that match a name pattern + [order-by] Criteria to use when ordering Database Instance listings (created_at_asc | created_at_desc | name_asc | name_desc | status_asc | status_desc) + [project-id] Project ID to list the Database Instance of + [organization-id] Organization ID the Database Instance belongs to + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all) + +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-mongodb-instance-update-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-instance-update-usage.golden new file mode 100644 index 0000000000..a84c8d7c8f --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-instance-update-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Update the parameters of a MongoDB™ Database Instance. + +USAGE: + scw mongodb instance update [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance to update + [name] Name of the Database Instance + [tags.{index}] Tags of a Database Instance + [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 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-mongodb-instance-upgrade-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-instance-upgrade-usage.golden new file mode 100644 index 0000000000..de07e717f9 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-instance-upgrade-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Upgrade your current Database Instance specifications like volume size. + +USAGE: + scw mongodb instance upgrade [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance you want to upgrade + [volume-size] Increase your block storage volume size + [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 upgrade + +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-mongodb-instance-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-instance-usage.golden new file mode 100644 index 0000000000..f0d58e335b --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-instance-usage.golden @@ -0,0 +1,26 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +A Managed Database for MongoDB instance is composed of one or multiple dedicated compute nodes running a single database engine. + +USAGE: + scw mongodb instance + +AVAILABLE COMMANDS: + create Create a MongoDB™ Database Instance + delete Delete a MongoDB™ Database Instance + get Get a MongoDB™ Database Instance + get-certificate Get the certificate of a Database Instance + list List MongoDB™ Database Instances + update Update a MongoDB™ Database Instance + upgrade Upgrade a Database Instance + +FLAGS: + -h, --help help for instance + +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 mongodb instance [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-mongodb-node-type-list-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-node-type-list-usage.golden new file mode 100644 index 0000000000..dd97465d73 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-node-type-list-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +List available node types. + +USAGE: + scw mongodb node-type list [arg=value ...] + +ARGS: + [include-disabled-types] Defines whether or not to include disabled types + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all) + +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-mongodb-node-type-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-node-type-usage.golden new file mode 100644 index 0000000000..d6b74c5200 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-node-type-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Node types powering your instance. + +USAGE: + scw mongodb node-type + +AVAILABLE COMMANDS: + list List available node types + +FLAGS: + -h, --help help for node-type + +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 mongodb node-type [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-mongodb-snapshot-create-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-create-usage.golden new file mode 100644 index 0000000000..03134bc8db --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-create-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Create a new snapshot of a Database Instance. You must define the `name` and `instance_id` parameters in the request. + +USAGE: + scw mongodb snapshot create [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance to snapshot + [name] Name of the snapshot + [expires-at] Expiration date of the snapshot (must follow the ISO 8601 format) + [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-mongodb-snapshot-delete-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-delete-usage.golden new file mode 100644 index 0000000000..fecc6a4a45 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-delete-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Delete a given snapshot of a Database Instance. You must specify, in the endpoint, the `snapshot_id` parameter of the snapshot you want to delete. + +USAGE: + scw mongodb snapshot delete [arg=value ...] + +ARGS: + snapshot-id UUID of the snapshot + [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-mongodb-snapshot-get-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-get-usage.golden new file mode 100644 index 0000000000..b32046bfdd --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-get-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Retrieve information about a given snapshot of a Database Instance. You must specify, in the endpoint, the `snapshot_id` parameter of the snapshot you want to retrieve. + +USAGE: + scw mongodb snapshot get [arg=value ...] + +ARGS: + snapshot-id UUID of the snapshot + [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-mongodb-snapshot-list-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-list-usage.golden new file mode 100644 index 0000000000..a609b24614 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-list-usage.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +List snapshots. You can include the `instance_id` or `project_id` in your query to get the list of snapshots for specific Database Instances and/or Projects. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. + +USAGE: + scw mongodb snapshot list [arg=value ...] + +ARGS: + [instance-id] Instance ID the snapshots belongs to + [name] Lists Database snapshots that match a name pattern + [order-by] Criteria to use when ordering snapshot listings (created_at_asc | created_at_desc | name_asc | name_desc | expires_at_asc | expires_at_desc) + [project-id] Project ID to list the snapshots of + [organization-id] Organization ID the snapshots belongs to + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all) + +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-mongodb-snapshot-restore-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-restore-usage.golden new file mode 100644 index 0000000000..b6878a5571 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-restore-usage.golden @@ -0,0 +1,23 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Restore a given snapshot of a Database Instance. You must specify, in the endpoint, the `snapshot_id` parameter of the snapshot you want to restore, the `instance_name` of the new Database Instance, `node_type` of the new Database Instance and `node_number` of the new Database Instance. + +USAGE: + scw mongodb snapshot restore [arg=value ...] + +ARGS: + snapshot-id UUID of the snapshot + instance-name Name of the new Database Instance + node-type Node type to use for the new Database Instance + node-number Number of nodes to use for the new Database Instance + [volume.volume-type] Type of volume where data is stored (unknown_type | sbs_5k | sbs_15k) + [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 restore + +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-mongodb-snapshot-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-usage.golden new file mode 100644 index 0000000000..0761ad14f2 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-snapshot-usage.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Snapshots of your instance. + +USAGE: + scw mongodb snapshot + +AVAILABLE COMMANDS: + create Create a Database Instance snapshot + delete Delete a Database Instance snapshot + get Get a Database Instance snapshot + list List snapshots + restore Restore a Database Instance snapshot + +FLAGS: + -h, --help help for snapshot + +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 mongodb snapshot [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-mongodb-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-usage.golden new file mode 100644 index 0000000000..48507e002d --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-usage.golden @@ -0,0 +1,24 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +This API allows you to manage your Managed Databases for MongoDB. + +USAGE: + scw mongodb + +AVAILABLE COMMANDS: + instance Instance management commands + node-type Node types management commands + snapshot Snapshot management commands + user User management commands + version MongoDB™ version management commands + +FLAGS: + -h, --help help for mongodb + +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 mongodb [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-mongodb-user-list-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-user-list-usage.golden new file mode 100644 index 0000000000..33b6f93b75 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-user-list-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +List all users of a given Database Instance. + +USAGE: + scw mongodb user list [arg=value ...] + +ARGS: + [name] Name of the user + [order-by] Criteria to use when requesting user listing (name_asc | name_desc) + instance-id UUID of the Database Instance + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all) + +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-mongodb-user-update-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-user-update-usage.golden new file mode 100644 index 0000000000..335b043bca --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-user-update-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Update the parameters of a user on a Database Instance. You can update the `password` parameter, but you cannot change the name of the user. + +USAGE: + scw mongodb user update [arg=value ...] + +ARGS: + instance-id UUID of the Database Instance the user belongs to + name Name of the database user + [password] Password of the database user + [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 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-mongodb-user-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-user-usage.golden new file mode 100644 index 0000000000..f87da38028 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-user-usage.golden @@ -0,0 +1,21 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +Users are profiles to which you can attribute database-level permissions. They allow you to define permissions specific to each type of database usage. + +USAGE: + scw mongodb user + +AVAILABLE COMMANDS: + list List users of a Database Instance + update Update a user on a Database Instance + +FLAGS: + -h, --help help for user + +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 mongodb user [command] --help" for more information about a command. diff --git a/cmd/scw/testdata/test-all-usage-mongodb-version-list-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-version-list-usage.golden new file mode 100644 index 0000000000..ee3c415d73 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-version-list-usage.golden @@ -0,0 +1,19 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +List available MongoDB™ versions. + +USAGE: + scw mongodb version list [arg=value ...] + +ARGS: + [version] + [region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all) + +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-mongodb-version-usage.golden b/cmd/scw/testdata/test-all-usage-mongodb-version-usage.golden new file mode 100644 index 0000000000..4b4242b421 --- /dev/null +++ b/cmd/scw/testdata/test-all-usage-mongodb-version-usage.golden @@ -0,0 +1,20 @@ +🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲 +🟥🟥🟥 STDERR️️ 🟥🟥🟥️ +MongoDB™ versions powering your instance. + +USAGE: + scw mongodb version + +AVAILABLE COMMANDS: + list List available MongoDB™ versions + +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 mongodb version [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 ce2de18651..4b65437cb6 100644 --- a/cmd/scw/testdata/test-main-usage-usage.golden +++ b/cmd/scw/testdata/test-main-usage-usage.golden @@ -29,6 +29,7 @@ AVAILABLE COMMANDS: lb This API allows you to manage your Scaleway Load Balancer services marketplace This API allows you to find available images for use when launching a Scaleway Instance mnq These APIs allow you to manage your Messaging and Queuing NATS, SQS and SNS services + mongodb This API allows you to manage your Managed Databases for MongoDB object Object-storage utils rdb This API allows you to manage your Managed Databases for PostgreSQL and MySQL redis This API allows you to manage your Managed Databases for Redis™ diff --git a/commands/commands.go b/commands/commands.go index 6e8530e5ea..686024d394 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -37,6 +37,7 @@ import ( "github.com/scaleway/scaleway-cli/v2/internal/namespaces/login" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/marketplace/v2" mnq "github.com/scaleway/scaleway-cli/v2/internal/namespaces/mnq/v1beta1" + mongodb "github.com/scaleway/scaleway-cli/v2/internal/namespaces/mongodb/v1alpha1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/object/v1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/rdb/v1" "github.com/scaleway/scaleway-cli/v2/internal/namespaces/redis/v1" @@ -106,6 +107,7 @@ func GetCommands() *core.Commands { serverless_sqldb.GetCommands(), edgeservices.GetCommands(), login.GetCommands(), + mongodb.GetCommands(), ) if beta { diff --git a/go.mod b/go.mod index 9fd48b63ca..cd37f2fb79 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/mattn/go-isatty v0.0.20 github.com/moby/buildkit v0.13.2 github.com/opencontainers/go-digest v1.0.0 - github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241017133226-2eefb481a740 + github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241021115642-2d127a2d76c7 github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 17872a2af3..ba8549cb20 100644 --- a/go.sum +++ b/go.sum @@ -465,8 +465,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241017133226-2eefb481a740 h1:6znLikGwSaarp3QCambwHFyYde3Qm4bcmyumsWhkZWA= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241017133226-2eefb481a740/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241021115642-2d127a2d76c7 h1:mWi3yS37Lhf73OP2Z4CboKtXJM4mWDAUWFHKSx2WK7k= +github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241021115642-2d127a2d76c7/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg= github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8= github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM= github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA= diff --git a/internal/namespaces/mongodb/v1alpha1/custom.go b/internal/namespaces/mongodb/v1alpha1/custom.go new file mode 100644 index 0000000000..18d250ae5f --- /dev/null +++ b/internal/namespaces/mongodb/v1alpha1/custom.go @@ -0,0 +1,17 @@ +package mongodb + +import ( + "github.com/scaleway/scaleway-cli/v2/core" + "github.com/scaleway/scaleway-cli/v2/internal/human" + mongodb "github.com/scaleway/scaleway-sdk-go/api/mongodb/v1alpha1" +) + +func GetCommands() *core.Commands { + cmds := GetGeneratedCommands() + + human.RegisterMarshalerFunc(mongodb.SnapshotStatus(""), human.EnumMarshalFunc(snapshotStatusMarshalSpecs)) + human.RegisterMarshalerFunc(mongodb.InstanceStatus(""), human.EnumMarshalFunc(instanceStatusMarshalSpecs)) + human.RegisterMarshalerFunc(mongodb.NodeTypeStock(""), human.EnumMarshalFunc(nodeTypeStockMarshalSpecs)) + + return cmds +} diff --git a/internal/namespaces/mongodb/v1alpha1/custom_instance.go b/internal/namespaces/mongodb/v1alpha1/custom_instance.go new file mode 100644 index 0000000000..2890f16fae --- /dev/null +++ b/internal/namespaces/mongodb/v1alpha1/custom_instance.go @@ -0,0 +1,18 @@ +package mongodb + +import ( + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/v2/internal/human" + mongodb "github.com/scaleway/scaleway-sdk-go/api/mongodb/v1alpha1" +) + +var instanceStatusMarshalSpecs = human.EnumMarshalSpecs{ + mongodb.InstanceStatusConfiguring: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "configuring"}, + mongodb.InstanceStatusDeleting: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "deleting"}, + mongodb.InstanceStatusError: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "error"}, + mongodb.InstanceStatusInitializing: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "initializing"}, + mongodb.InstanceStatusLocked: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "locked"}, + mongodb.InstanceStatusProvisioning: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "provisioning"}, + mongodb.InstanceStatusReady: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "ready"}, + mongodb.InstanceStatusSnapshotting: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "snapshotting"}, +} diff --git a/internal/namespaces/mongodb/v1alpha1/custom_nodetype.go b/internal/namespaces/mongodb/v1alpha1/custom_nodetype.go new file mode 100644 index 0000000000..356d26a570 --- /dev/null +++ b/internal/namespaces/mongodb/v1alpha1/custom_nodetype.go @@ -0,0 +1,13 @@ +package mongodb + +import ( + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/v2/internal/human" + mongodb "github.com/scaleway/scaleway-sdk-go/api/mongodb/v1alpha1" +) + +var nodeTypeStockMarshalSpecs = human.EnumMarshalSpecs{ + mongodb.NodeTypeStockAvailable: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "available"}, + mongodb.NodeTypeStockLowStock: &human.EnumMarshalSpec{Attribute: color.FgYellow, Value: "low stock"}, + mongodb.NodeTypeStockOutOfStock: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "out of stock"}, +} diff --git a/internal/namespaces/mongodb/v1alpha1/custom_snapshot.go b/internal/namespaces/mongodb/v1alpha1/custom_snapshot.go new file mode 100644 index 0000000000..9d6f81ca65 --- /dev/null +++ b/internal/namespaces/mongodb/v1alpha1/custom_snapshot.go @@ -0,0 +1,16 @@ +package mongodb + +import ( + "github.com/fatih/color" + "github.com/scaleway/scaleway-cli/v2/internal/human" + mongodb "github.com/scaleway/scaleway-sdk-go/api/mongodb/v1alpha1" +) + +var snapshotStatusMarshalSpecs = human.EnumMarshalSpecs{ + mongodb.SnapshotStatusCreating: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "creating"}, + mongodb.SnapshotStatusDeleting: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "deleting"}, + mongodb.SnapshotStatusError: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "error"}, + mongodb.SnapshotStatusLocked: &human.EnumMarshalSpec{Attribute: color.FgRed, Value: "locked"}, + mongodb.SnapshotStatusReady: &human.EnumMarshalSpec{Attribute: color.FgGreen, Value: "ready"}, + mongodb.SnapshotStatusRestoring: &human.EnumMarshalSpec{Attribute: color.FgBlue, Value: "restoring"}, +} diff --git a/internal/namespaces/mongodb/v1alpha1/mongodb_cli.go b/internal/namespaces/mongodb/v1alpha1/mongodb_cli.go new file mode 100644 index 0000000000..1aab79bfbd --- /dev/null +++ b/internal/namespaces/mongodb/v1alpha1/mongodb_cli.go @@ -0,0 +1,837 @@ +// This file was automatically generated. DO NOT EDIT. +// If you have any remark or suggestion do not hesitate to open an issue. + +package mongodb + +import ( + "context" + "reflect" + + "github.com/scaleway/scaleway-cli/v2/core" + "github.com/scaleway/scaleway-sdk-go/api/mongodb/v1alpha1" + "github.com/scaleway/scaleway-sdk-go/scw" +) + +// always import dependencies +var ( + _ = scw.RegionFrPar +) + +func GetGeneratedCommands() *core.Commands { + return core.NewCommands( + mongodbRoot(), + mongodbNodeType(), + mongodbVersion(), + mongodbInstance(), + mongodbSnapshot(), + mongodbUser(), + mongodbNodeTypeList(), + mongodbVersionList(), + mongodbInstanceList(), + mongodbInstanceGet(), + mongodbInstanceCreate(), + mongodbInstanceUpdate(), + mongodbInstanceDelete(), + mongodbInstanceUpgrade(), + mongodbInstanceGetCertificate(), + mongodbSnapshotCreate(), + mongodbSnapshotGet(), + mongodbSnapshotRestore(), + mongodbSnapshotList(), + mongodbSnapshotDelete(), + mongodbUserList(), + mongodbUserUpdate(), + ) +} +func mongodbRoot() *core.Command { + return &core.Command{ + Short: `This API allows you to manage your Managed Databases for MongoDB`, + Long: `This API allows you to manage your Managed Databases for MongoDB.`, + Namespace: "mongodb", + } +} + +func mongodbNodeType() *core.Command { + return &core.Command{ + Short: `Node types management commands`, + Long: `Node types powering your instance.`, + Namespace: "mongodb", + Resource: "node-type", + } +} + +func mongodbVersion() *core.Command { + return &core.Command{ + Short: `MongoDB™ version management commands`, + Long: `MongoDB™ versions powering your instance.`, + Namespace: "mongodb", + Resource: "version", + } +} + +func mongodbInstance() *core.Command { + return &core.Command{ + Short: `Instance management commands`, + Long: `A Managed Database for MongoDB instance is composed of one or multiple dedicated compute nodes running a single database engine.`, + Namespace: "mongodb", + Resource: "instance", + } +} + +func mongodbSnapshot() *core.Command { + return &core.Command{ + Short: `Snapshot management commands`, + Long: `Snapshots of your instance.`, + Namespace: "mongodb", + Resource: "snapshot", + } +} + +func mongodbUser() *core.Command { + return &core.Command{ + Short: `User management commands`, + Long: `Users are profiles to which you can attribute database-level permissions. They allow you to define permissions specific to each type of database usage.`, + Namespace: "mongodb", + Resource: "user", + } +} + +func mongodbNodeTypeList() *core.Command { + return &core.Command{ + Short: `List available node types`, + Long: `List available node types.`, + Namespace: "mongodb", + Resource: "node-type", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.ListNodeTypesRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "include-disabled-types", + Short: `Defines whether or not to include disabled types`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.ListNodeTypesRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + opts := []scw.RequestOption{scw.WithAllPages()} + if request.Region == scw.Region(core.AllLocalities) { + opts = append(opts, scw.WithRegions(api.Regions()...)) + request.Region = "" + } + resp, err := api.ListNodeTypes(request, opts...) + if err != nil { + return nil, err + } + return resp.NodeTypes, nil + + }, + } +} + +func mongodbVersionList() *core.Command { + return &core.Command{ + Short: `List available MongoDB™ versions`, + Long: `List available MongoDB™ versions.`, + Namespace: "mongodb", + Resource: "version", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.ListVersionsRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "version", + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.ListVersionsRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + opts := []scw.RequestOption{scw.WithAllPages()} + if request.Region == scw.Region(core.AllLocalities) { + opts = append(opts, scw.WithRegions(api.Regions()...)) + request.Region = "" + } + resp, err := api.ListVersions(request, opts...) + if err != nil { + return nil, err + } + return resp.Versions, nil + + }, + } +} + +func mongodbInstanceList() *core.Command { + return &core.Command{ + Short: `List MongoDB™ Database Instances`, + Long: `List all MongoDB™ Database Instances in the specified region, for a given Scaleway Project. By default, the MongoDB™ 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.`, + Namespace: "mongodb", + Resource: "instance", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.ListInstancesRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "tags.{index}", + Short: `List Database Instances that have a given tag`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "name", + Short: `Lists Database Instances that match a name pattern`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "order-by", + Short: `Criteria to use when ordering Database Instance listings`, + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"created_at_asc", "created_at_desc", "name_asc", "name_desc", "status_asc", "status_desc"}, + }, + { + Name: "project-id", + Short: `Project ID to list the Database Instance of`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "organization-id", + Short: `Organization ID the Database Instance belongs to`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.ListInstancesRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + opts := []scw.RequestOption{scw.WithAllPages()} + if request.Region == scw.Region(core.AllLocalities) { + opts = append(opts, scw.WithRegions(api.Regions()...)) + request.Region = "" + } + resp, err := api.ListInstances(request, opts...) + if err != nil { + return nil, err + } + return resp.Instances, nil + + }, + } +} + +func mongodbInstanceGet() *core.Command { + return &core.Command{ + Short: `Get a MongoDB™ Database Instance`, + Long: `Retrieve information about a given MongoDB™ Database Instance, specified by the ` + "`" + `region` + "`" + ` and ` + "`" + `instance_id` + "`" + ` parameters. Its full details, including name, status, IP address and port, are returned in the response object.`, + Namespace: "mongodb", + Resource: "instance", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.GetInstanceRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the Database Instance`, + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.GetInstanceRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.GetInstance(request) + + }, + } +} + +func mongodbInstanceCreate() *core.Command { + return &core.Command{ + Short: `Create a MongoDB™ Database Instance`, + Long: `Create a new MongoDB™ Database Instance.`, + Namespace: "mongodb", + Resource: "instance", + Verb: "create", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.CreateInstanceRequest{}), + ArgSpecs: core.ArgSpecs{ + core.ProjectIDArgSpec(), + { + Name: "name", + Short: `Name of the Database Instance`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "version", + Short: `Version of the MongoDB™ engine`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "tags.{index}", + Short: `Tags to apply to the Database Instance`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "node-number", + Short: `Number of node to use for the Database Instance`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "node-type", + Short: `Type of node to use for the Database Instance`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "user-name", + Short: `Username created when the Database Instance is created`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "password", + Short: `Password of the initial user`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "volume.volume-size", + Short: `Volume size`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "volume.volume-type", + Short: `Type of volume where data is stored`, + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"unknown_type", "sbs_5k", "sbs_15k"}, + }, + { + Name: "endpoints.{index}.private-network.private-network-id", + Short: `UUID of the private network`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.CreateInstanceRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.CreateInstance(request) + + }, + } +} + +func mongodbInstanceUpdate() *core.Command { + return &core.Command{ + Short: `Update a MongoDB™ Database Instance`, + Long: `Update the parameters of a MongoDB™ Database Instance.`, + Namespace: "mongodb", + Resource: "instance", + Verb: "update", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.UpdateInstanceRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the Database Instance to update`, + Required: true, + Deprecated: false, + Positional: true, + }, + { + Name: "name", + Short: `Name of the Database Instance`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "tags.{index}", + Short: `Tags of a Database Instance`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.UpdateInstanceRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.UpdateInstance(request) + + }, + } +} + +func mongodbInstanceDelete() *core.Command { + return &core.Command{ + Short: `Delete a MongoDB™ Database Instance`, + Long: `Delete a given MongoDB™ Database Instance, specified by the ` + "`" + `region` + "`" + ` and ` + "`" + `instance_id` + "`" + ` parameters. Deleting a MongoDB™ Database Instance is permanent, and cannot be undone. Note that upon deletion all your data will be lost.`, + Namespace: "mongodb", + Resource: "instance", + Verb: "delete", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.DeleteInstanceRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the Database Instance to delete`, + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.DeleteInstanceRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.DeleteInstance(request) + + }, + } +} + +func mongodbInstanceUpgrade() *core.Command { + return &core.Command{ + Short: `Upgrade a Database Instance`, + Long: `Upgrade your current Database Instance specifications like volume size.`, + Namespace: "mongodb", + Resource: "instance", + Verb: "upgrade", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.UpgradeInstanceRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the Database Instance you want to upgrade`, + Required: true, + Deprecated: false, + Positional: true, + }, + { + Name: "volume-size", + Short: `Increase your block storage volume size`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.UpgradeInstanceRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.UpgradeInstance(request) + + }, + } +} + +func mongodbInstanceGetCertificate() *core.Command { + return &core.Command{ + Short: `Get the certificate of a Database Instance`, + Long: `Retrieve the certificate of a given Database Instance, specified by the ` + "`" + `instance_id` + "`" + ` parameter.`, + Namespace: "mongodb", + Resource: "instance", + Verb: "get-certificate", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.GetInstanceCertificateRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the Database Instance`, + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.GetInstanceCertificateRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.GetInstanceCertificate(request) + + }, + } +} + +func mongodbSnapshotCreate() *core.Command { + return &core.Command{ + Short: `Create a Database Instance snapshot`, + Long: `Create a new snapshot of a Database Instance. You must define the ` + "`" + `name` + "`" + ` and ` + "`" + `instance_id` + "`" + ` parameters in the request.`, + Namespace: "mongodb", + Resource: "snapshot", + Verb: "create", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.CreateSnapshotRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the Database Instance to snapshot`, + Required: true, + Deprecated: false, + Positional: true, + }, + { + Name: "name", + Short: `Name of the snapshot`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "expires-at", + Short: `Expiration date of the snapshot (must follow the ISO 8601 format)`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.CreateSnapshotRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.CreateSnapshot(request) + + }, + } +} + +func mongodbSnapshotGet() *core.Command { + return &core.Command{ + Short: `Get a Database Instance snapshot`, + Long: `Retrieve information about a given snapshot of a Database Instance. You must specify, in the endpoint, the ` + "`" + `snapshot_id` + "`" + ` parameter of the snapshot you want to retrieve.`, + Namespace: "mongodb", + Resource: "snapshot", + Verb: "get", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.GetSnapshotRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "snapshot-id", + Short: `UUID of the snapshot`, + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.GetSnapshotRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.GetSnapshot(request) + + }, + } +} + +func mongodbSnapshotRestore() *core.Command { + return &core.Command{ + Short: `Restore a Database Instance snapshot`, + Long: `Restore a given snapshot of a Database Instance. You must specify, in the endpoint, the ` + "`" + `snapshot_id` + "`" + ` parameter of the snapshot you want to restore, the ` + "`" + `instance_name` + "`" + ` of the new Database Instance, ` + "`" + `node_type` + "`" + ` of the new Database Instance and ` + "`" + `node_number` + "`" + ` of the new Database Instance.`, + Namespace: "mongodb", + Resource: "snapshot", + Verb: "restore", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.RestoreSnapshotRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "snapshot-id", + Short: `UUID of the snapshot`, + Required: true, + Deprecated: false, + Positional: true, + }, + { + Name: "instance-name", + Short: `Name of the new Database Instance`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "node-type", + Short: `Node type to use for the new Database Instance`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "node-number", + Short: `Number of nodes to use for the new Database Instance`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "volume.volume-type", + Short: `Type of volume where data is stored`, + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"unknown_type", "sbs_5k", "sbs_15k"}, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.RestoreSnapshotRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.RestoreSnapshot(request) + + }, + } +} + +func mongodbSnapshotList() *core.Command { + return &core.Command{ + Short: `List snapshots`, + Long: `List snapshots. You can include the ` + "`" + `instance_id` + "`" + ` or ` + "`" + `project_id` + "`" + ` in your query to get the list of snapshots for specific Database Instances and/or Projects. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the ` + "`" + `order_by` + "`" + ` field.`, + Namespace: "mongodb", + Resource: "snapshot", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.ListSnapshotsRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `Instance ID the snapshots belongs to`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "name", + Short: `Lists Database snapshots that match a name pattern`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "order-by", + Short: `Criteria to use when ordering snapshot listings`, + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"created_at_asc", "created_at_desc", "name_asc", "name_desc", "expires_at_asc", "expires_at_desc"}, + }, + { + Name: "project-id", + Short: `Project ID to list the snapshots of`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "organization-id", + Short: `Organization ID the snapshots belongs to`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.ListSnapshotsRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + opts := []scw.RequestOption{scw.WithAllPages()} + if request.Region == scw.Region(core.AllLocalities) { + opts = append(opts, scw.WithRegions(api.Regions()...)) + request.Region = "" + } + resp, err := api.ListSnapshots(request, opts...) + if err != nil { + return nil, err + } + return resp.Snapshots, nil + + }, + } +} + +func mongodbSnapshotDelete() *core.Command { + return &core.Command{ + Short: `Delete a Database Instance snapshot`, + Long: `Delete a given snapshot of a Database Instance. You must specify, in the endpoint, the ` + "`" + `snapshot_id` + "`" + ` parameter of the snapshot you want to delete.`, + Namespace: "mongodb", + Resource: "snapshot", + Verb: "delete", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.DeleteSnapshotRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "snapshot-id", + Short: `UUID of the snapshot`, + Required: true, + Deprecated: false, + Positional: true, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.DeleteSnapshotRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.DeleteSnapshot(request) + + }, + } +} + +func mongodbUserList() *core.Command { + return &core.Command{ + Short: `List users of a Database Instance`, + Long: `List all users of a given Database Instance.`, + Namespace: "mongodb", + Resource: "user", + Verb: "list", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.ListUsersRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "name", + Short: `Name of the user`, + Required: false, + Deprecated: false, + Positional: false, + }, + { + Name: "order-by", + Short: `Criteria to use when requesting user listing`, + Required: false, + Deprecated: false, + Positional: false, + EnumValues: []string{"name_asc", "name_desc"}, + }, + { + Name: "instance-id", + Short: `UUID of the Database Instance`, + Required: true, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.ListUsersRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + opts := []scw.RequestOption{scw.WithAllPages()} + if request.Region == scw.Region(core.AllLocalities) { + opts = append(opts, scw.WithRegions(api.Regions()...)) + request.Region = "" + } + resp, err := api.ListUsers(request, opts...) + if err != nil { + return nil, err + } + return resp.Users, nil + + }, + } +} + +func mongodbUserUpdate() *core.Command { + return &core.Command{ + Short: `Update a user on a Database Instance`, + Long: `Update the parameters of a user on a Database Instance. You can update the ` + "`" + `password` + "`" + ` parameter, but you cannot change the name of the user.`, + Namespace: "mongodb", + Resource: "user", + Verb: "update", + // Deprecated: false, + ArgsType: reflect.TypeOf(mongodb.UpdateUserRequest{}), + ArgSpecs: core.ArgSpecs{ + { + Name: "instance-id", + Short: `UUID of the Database Instance the user belongs to`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "name", + Short: `Name of the database user`, + Required: true, + Deprecated: false, + Positional: false, + }, + { + Name: "password", + Short: `Password of the database user`, + Required: false, + Deprecated: false, + Positional: false, + }, + core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw), + }, + Run: func(ctx context.Context, args interface{}) (i interface{}, e error) { + request := args.(*mongodb.UpdateUserRequest) + + client := core.ExtractClient(ctx) + api := mongodb.NewAPI(client) + return api.UpdateUser(request) + + }, + } +}