Skip to main content

postgresqls

Creates, updates, deletes, gets or lists a postgresqls resource.

Overview​

Namepostgresqls
TypeResource
Idovh.public_cloud_database.postgresqls

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Unique identifier of the service
checksumstringHash of the resource used for concurrency control
created_atstring (date-time)Date at which the service was created (wire: createdAt)
current_stateobjectCurrent configuration deployed on the service (wire: currentState)
current_tasksarrayAsynchronous operations currently running on the service (wire: currentTasks)
resource_statusstringReadiness status of the service. A new target specification is accepted only in READY status. (CREATING, CREATION_PLANNED, DELETING, ERROR, OUT_OF_SYNC, READY, SUSPENDED, UNKNOWN, UPDATING) (wire: resourceStatus)
target_specobjectLast requested target specification for the service (wire: targetSpec)
updated_atstring (date-time)Date of the last update to the service (wire: updatedAt)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_id, project_idReturns the target specification of the service, its current state and its running tasks. (Beta version)
listselectproject_idx_pagination_cursor, x_pagination_sizeReturns the PostgreSQL services of the project. (Beta version)
createinsertproject_id, target_specCreates a PostgreSQL service from a plan, a flavor and an engine version. Creation is asynchronous: follow resourceStatus until READY. Set forkSourceServiceId to create it from a backup of another service. (Beta version)
updateupdateservice_id, project_id, target_specPartially updates the target specification of the service, for example its plan, flavor, version or number of nodes. Omitted fields keep their current value. A new target specification is accepted only in READY status. (Beta version)
deletedeleteservice_id, project_iddelete_backupsDeletes the service. A service with deletion protection enabled cannot be deleted.<br />By default, the service's backups are kept, and a last backup is taken once the service is stopped. They stay listed and can be forked until they expire, at the end of the retention configured when the service was deleted. They are billed until they expire, then deleted.<br />Set deleteBackups to true to delete them with the service. (Beta version)
replaceexecserviceId, project_id, targetSpecUpdates the target specification of the service, for example its plan, flavor, version or number of nodes. Every field is required: the request describes the whole configuration. A new target specification is accepted only in READY status. (Beta version)
enable_writesexecserviceId, project_idEnables temporary write permissions on a service locked in read-only mode because its disk is full. Returns the date when they are revoked. (Beta version)
log_urlexecserviceId, project_id, kindGenerates a temporary URL to read the logs of one kind. The URL expires. (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.

NameDatatypeDescription
api_hoststringThe 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"}})
project_idstringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
serviceIdstring (uuid)Service ID
service_idstring (uuid)Service ID (wire: serviceId)
delete_backupsbooleanWhether to also delete the service's backups. Defaults to false. (wire: deleteBackups)
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the target specification of the service, its current state and its running tasks. (Beta version)

SELECT
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
FROM ovh.public_cloud_database.postgresqls
WHERE service_id = '{{ service_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Creates a PostgreSQL service from a plan, a flavor and an engine version. Creation is asynchronous: follow resourceStatus until READY. Set forkSourceServiceId to create it from a backup of another service. (Beta version)

INSERT INTO ovh.public_cloud_database.postgresqls (
target_spec,
project_id
)
SELECT
'{{ target_spec }}' /* required */,
'{{ project_id }}'
RETURNING
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
;

UPDATE examples​

Partially updates the target specification of the service, for example its plan, flavor, version or number of nodes. Omitted fields keep their current value. A new target specification is accepted only in READY status. (Beta version)

UPDATE ovh.public_cloud_database.postgresqls
SET
target_spec = '{{ target_spec }}'
WHERE
service_id = '{{ service_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
AND target_spec = '{{ target_spec }}' --required
RETURNING
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at;

DELETE examples​

Deletes the service. A service with deletion protection enabled cannot be deleted.<br />By default, the service's backups are kept, and a last backup is taken once the service is stopped. They stay listed and can be forked until they expire, at the end of the retention configured when the service was deleted. They are billed until they expire, then deleted.<br />Set deleteBackups to true to delete them with the service. (Beta version)

DELETE FROM ovh.public_cloud_database.postgresqls
WHERE service_id = '{{ service_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
AND delete_backups = '{{ delete_backups }}'
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Updates the target specification of the service, for example its plan, flavor, version or number of nodes. Every field is required: the request describes the whole configuration. A new target specification is accepted only in READY status. (Beta version)

EXEC ovh.public_cloud_database.postgresqls.replace
@serviceId='{{ serviceId }}' --required,
@project_id='{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"targetSpec": "{{ targetSpec }}"
}'
;