Skip to content

Commit

Permalink
feat(documentdb): enable command documentdb (#3387)
Browse files Browse the repository at this point in the history
  • Loading branch information
Monitob authored Oct 3, 2023
1 parent 622ac6a commit 89f428a
Show file tree
Hide file tree
Showing 66 changed files with 2,587 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ To enable beta features, you can set `SCW_ENABLE_BETA=1` in your environment.
| `cockpit` | Cockpit API | [CLI](./docs/commands/cockpit.md) / [API](https://developers.scaleway.com/en/products/cockpit/api/) |
| `config` | Config file management | [CLI](./docs/commands/config.md) |
| `container` | Serverless Container API | [CLI](./docs/commands/container.md) / [API](https://developers.scaleway.com/en/products/containers/api/) |
| `documentdb` | DocumentDB API | [CLI](./docs/commands/document-db.md) / [API](https://www.scaleway.com/en/developers/api/document_db/) |
| `dns` | DNS API | [CLI](./docs/commands/dns.md) / [API](https://developers.scaleway.com/en/products/domain/dns/api/) |
| `feedback` | Send feedback to the Scaleway CLI Team! | [CLI](./docs/commands/feedback.md) |
| `flexibleip` | Flexible IP API | [CLI](./docs/commands/fip.md) / [API](https://developers.scaleway.com/en/products/flexible-ip/api/) |
Expand Down
21 changes: 21 additions & 0 deletions cmd/scw/testdata/test-all-usage-document-db-acl-add-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Add an additional ACL rule to a Database Instance.

USAGE:
scw document-db acl add [arg=value ...]

ARGS:
instance-id UUID of the Database Instance you want to add ACL rules to
[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 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Delete one or more ACL rules of a Database Instance.

USAGE:
scw document-db acl delete [arg=value ...]

ARGS:
instance-id UUID of the Database Instance you want to delete an ACL rule from
acl-rule-ips.{index} IP addresses defined in the ACL rules 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 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
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-document-db-acl-list-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List the ACL rules for a given Database Instance. The response is an array of ACL objects, each one representing an ACL that denies, allows or redirects traffic based on certain conditions.

USAGE:
scw document-db acl list [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 | 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
21 changes: 21 additions & 0 deletions cmd/scw/testdata/test-all-usage-document-db-acl-set-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Replace all the ACL rules of a Database Instance.

USAGE:
scw document-db 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
23 changes: 23 additions & 0 deletions cmd/scw/testdata/test-all-usage-document-db-acl-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Network Access Control Lists allow you to control incoming network traffic by setting up ACL rules.

USAGE:
scw document-db acl <command>

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

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 document-db acl [command] --help" for more information about a command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Create a new database. You must define the `name` parameter in the request.

USAGE:
scw document-db database create [arg=value ...]

ARGS:
instance-id UUID of the Database Instance where to create the database
[name] Name of the database
[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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Delete a given database on a Database Instance. You must specify, in the endpoint, the `region`, `instance_id` and `name` parameters of the database you want to delete.

USAGE:
scw document-db database delete [arg=value ...]

ARGS:
instance-id UUID of the Database Instance where to delete the database
name Name of the database 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List all databases of a given Database Instance. By default, the databases 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 `name`, `managed` and `owner`.

USAGE:
scw document-db database list [arg=value ...]

ARGS:
[name] Name of the database
[managed] Defines whether or not the database is managed
[owner] User that owns this database
[order-by] Criteria to use when ordering database listing (name_asc | name_desc | size_asc | size_desc)
instance-id UUID of the Database Instance to list the databases of
[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
22 changes: 22 additions & 0 deletions cmd/scw/testdata/test-all-usage-document-db-database-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Databases can be used to store and manage sets of structured information, or data. The interaction between the user and a database is done using a Database Engine, which provides a structured query language to add, modify or delete information from the database.

USAGE:
scw document-db database <command>

AVAILABLE COMMANDS:
create Create a database in a Database Instance
delete Delete a database in a Database Instance
list List databases in a Database Instance

FLAGS:
-h, --help help for database

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 document-db database [command] --help" for more information about a command.
Original file line number Diff line number Diff line change
@@ -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.

USAGE:
scw document-db 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
Original file line number Diff line number Diff line change
@@ -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 document-db 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
Original file line number Diff line number Diff line change
@@ -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 document-db 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Migrate an existing Database Instance endpoint to another Database Instance.

USAGE:
scw document-db 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
29 changes: 29 additions & 0 deletions cmd/scw/testdata/test-all-usage-document-db-endpoint-usage.golden
Original file line number Diff line number Diff line change
@@ -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 document-db endpoint <command>

AVAILABLE COMMANDS:
create Create a new Database Instance endpoint
delete Delete a Database Instance endpoint
get Get a Database Instance endpoint
migrate Migrate Database Instance endpoint

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 document-db endpoint [command] --help" for more information about a command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
List the FerretDB database engines available at Scaleway.

USAGE:
scw document-db engine list [arg=value ...]

ARGS:
[name] Name of the database engine
[version] Version of the database engine
[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
20 changes: 20 additions & 0 deletions cmd/scw/testdata/test-all-usage-document-db-engine-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
A database engine is the software component that stores and retrieves your data from a database. Currently FerretDB 1.X is available.

USAGE:
scw document-db engine <command>

AVAILABLE COMMANDS:
list List available database engines

FLAGS:
-h, --help help for engine

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 document-db engine [command] --help" for more information about a command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Clone a given Database Instance, specified by the `region` and `instance_id` parameters. The clone feature allows you to create a new Database Instance from an existing one. The clone includes all existing databases, users and permissions. You can create a clone on a Database Instance bigger than your current one.

USAGE:
scw document-db instance clone <instance-id ...> [arg=value ...]

ARGS:
instance-id UUID of the Database Instance you want to clone
[name] Name of the Database Instance clone
[node-type] Node type of the clone
[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 clone

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
Loading

0 comments on commit 89f428a

Please sign in to comment.