postgresql_databases
Creates, updates, deletes, gets or lists a postgresql_databases resource.
Overview​
| Name | postgresql_databases |
| Type | Resource |
| Id | ovh.public_cloud_database.postgresql_databases |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Unique identifier of the database |
name | string | Name of the database |
checksum | string | Hash of the resource used for concurrency control |
created_at | string (date-time) | Date at which the resource was created (wire: createdAt) |
default | boolean | Whether this is the engine default database created automatically at provisioning time |
updated_at | string (date-time) | Date of the last update to the resource (wire: updatedAt) |
A logical database on a managed database service
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Unique identifier of the database |
name | string | Name of the database |
checksum | string | Hash of the resource used for concurrency control |
created_at | string (date-time) | Date at which the resource was created (wire: createdAt) |
default | boolean | Whether this is the engine default database created automatically at provisioning time |
updated_at | string (date-time) | Date of the last update to the resource (wire: updatedAt) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | database_id, service_id, project_id | Returns the database name and whether it is the engine default database. (Beta version) | |
list | select | service_id, project_id | x_pagination_cursor, x_pagination_size | Returns the databases of the service, including the engine default database. (Beta version) |
create | insert | service_id, project_id, name | Creates a database with the given name. (Beta version) | |
delete | delete | database_id, service_id, project_id | Permanently deletes the database. The engine default database cannot be deleted. (Beta version) |
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 |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
database_id | string (uuid) | Database ID (wire: databaseId) |
project_id | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
service_id | string (uuid) | Service ID (wire: serviceId) |
x_pagination_cursor | string | Pagination cursor (wire: X-Pagination-Cursor) |
x_pagination_size | integer | Pagination size (wire: X-Pagination-Size) |
SELECT examples​
- get
- list
Returns the database name and whether it is the engine default database. (Beta version)
SELECT
id,
name,
checksum,
created_at,
default,
updated_at
FROM ovh.public_cloud_database.postgresql_databases
WHERE database_id = '{{ database_id }}' -- required
AND service_id = '{{ service_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Returns the databases of the service, including the engine default database. (Beta version)
SELECT
id,
name,
checksum,
created_at,
default,
updated_at
FROM ovh.public_cloud_database.postgresql_databases
WHERE service_id = '{{ service_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND x_pagination_cursor = '{{ x_pagination_cursor }}'
AND x_pagination_size = '{{ x_pagination_size }}'
;
INSERT examples​
- create
- Manifest
Creates a database with the given name. (Beta version)
INSERT INTO ovh.public_cloud_database.postgresql_databases (
name,
service_id,
project_id
)
SELECT
'{{ name }}' /* required */,
'{{ service_id }}',
'{{ project_id }}'
RETURNING
id,
name,
checksum,
created_at,
default,
updated_at
;
# Description fields are for documentation purposes
- name: postgresql_databases
props:
- name: service_id
value: "{{ service_id }}"
description: Required parameter for the postgresql_databases resource.
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the postgresql_databases resource.
- name: name
value: "{{ name }}"
description: |
Name of the database to create
DELETE examples​
- delete
Permanently deletes the database. The engine default database cannot be deleted. (Beta version)
DELETE FROM ovh.public_cloud_database.postgresql_databases
WHERE database_id = '{{ database_id }}' --required
AND service_id = '{{ service_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;