dbs
Creates, updates, deletes, gets or lists a dbs
resource.
Overview
Name | dbs |
Type | Resource |
Id | digitalocean.databases.dbs |
Fields
The following fields are returned by SELECT
queries:
- databases_get
- databases_list
A JSON object with a key of db
.
Name | Datatype | Description |
---|---|---|
name | string | The name of the database. (example: alpha) |
A JSON object with a key of databases
.
Name | Datatype | Description |
---|---|---|
name | string | The name of the database. (example: alpha) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
databases_get | select | database_cluster_uuid , database_name | To show information about an existing database cluster, send a GET request to/v2/databases/$DATABASE_ID/dbs/$DB_NAME .Note: Database management is not supported for Caching or Valkey clusters. The response will be a JSON object with a db key. This will be set to an objectcontaining the standard database attributes. | |
databases_list | select | database_cluster_uuid | To list all of the databases in a clusters, send a GET request to/v2/databases/$DATABASE_ID/dbs .The result will be a JSON object with a dbs key. This will be set to an arrayof database objects, each of which will contain the standard database attributes. Note: Database management is not supported for Caching or Valkey clusters. | |
databases_add | insert | database_cluster_uuid , data__name | To add a new database to an existing cluster, send a POST request to/v2/databases/$DATABASE_ID/dbs .Note: Database management is not supported for Caching or Valkey clusters. The response will be a JSON object with a key called db . The value of this will bean object that contains the standard attributes associated with a database. | |
databases_delete | delete | database_cluster_uuid , database_name | To delete a specific database, send a DELETE request to/v2/databases/$DATABASE_ID/dbs/$DB_NAME .A status of 204 will be given. This indicates that the request was processed successfully, but that no response body is needed. Note: Database management is not supported for Caching or Valkey clusters. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
database_cluster_uuid | string (uuid) | A unique identifier for a database cluster. (example: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) |
database_name | string | The name of the database. (example: alpha) |
SELECT
examples
- databases_get
- databases_list
To show information about an existing database cluster, send a GET request to/v2/databases/$DATABASE_ID/dbs/$DB_NAME
.
Note: Database management is not supported for Caching or Valkey clusters.
The response will be a JSON object with a db
key. This will be set to an object
containing the standard database attributes.
SELECT
name
FROM digitalocean.databases.dbs
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' -- required
AND database_name = '{{ database_name }}' -- required;
To list all of the databases in a clusters, send a GET request to/v2/databases/$DATABASE_ID/dbs
.
The result will be a JSON object with a dbs
key. This will be set to an array
of database objects, each of which will contain the standard database attributes.
Note: Database management is not supported for Caching or Valkey clusters.
SELECT
name
FROM digitalocean.databases.dbs
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' -- required;
INSERT
examples
- databases_add
- Manifest
To add a new database to an existing cluster, send a POST request to/v2/databases/$DATABASE_ID/dbs
.
Note: Database management is not supported for Caching or Valkey clusters.
The response will be a JSON object with a key called db
. The value of this will be
an object that contains the standard attributes associated with a database.
INSERT INTO digitalocean.databases.dbs (
data__name,
database_cluster_uuid
)
SELECT
'{{ name }}' --required,
'{{ database_cluster_uuid }}'
RETURNING
db
;
# Description fields are for documentation purposes
- name: dbs
props:
- name: database_cluster_uuid
value: string (uuid)
description: Required parameter for the dbs resource.
- name: name
value: string
description: >
The name of the database.
DELETE
examples
- databases_delete
To delete a specific database, send a DELETE request to/v2/databases/$DATABASE_ID/dbs/$DB_NAME
.
A status of 204 will be given. This indicates that the request was processed
successfully, but that no response body is needed.
Note: Database management is not supported for Caching or Valkey clusters.
DELETE FROM digitalocean.databases.dbs
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' --required
AND database_name = '{{ database_name }}' --required;