postgresqls
Creates, updates, deletes, gets or lists a postgresqls resource.
Overview​
| Name | postgresqls |
| Type | Resource |
| Id | ovh.public_cloud_database.postgresqls |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Unique identifier of the service |
checksum | string | Hash of the resource used for concurrency control |
created_at | string (date-time) | Date at which the service was created (wire: createdAt) |
current_state | object | Current configuration deployed on the service (wire: currentState) |
current_tasks | array | Asynchronous operations currently running on the service (wire: currentTasks) |
resource_status | string | Readiness 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_spec | object | Last requested target specification for the service (wire: targetSpec) |
updated_at | string (date-time) | Date of the last update to the service (wire: updatedAt) |
A managed database service
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Unique identifier of the service |
checksum | string | Hash of the resource used for concurrency control |
created_at | string (date-time) | Date at which the service was created (wire: createdAt) |
current_state | object | Current configuration deployed on the service (wire: currentState) |
current_tasks | array | Asynchronous operations currently running on the service (wire: currentTasks) |
resource_status | string | Readiness 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_spec | object | Last requested target specification for the service (wire: targetSpec) |
updated_at | string (date-time) | Date of the last update to the service (wire: updatedAt) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | service_id, project_id | Returns the target specification of the service, its current state and its running tasks. (Beta version) | |
list | select | project_id | x_pagination_cursor, x_pagination_size | Returns the PostgreSQL services of the project. (Beta version) |
create | insert | project_id, target_spec | 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) | |
update | update | service_id, project_id, target_spec | 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) | |
delete | delete | service_id, project_id | delete_backups | 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) |
replace | exec | serviceId, project_id, targetSpec | 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) | |
enable_writes | exec | serviceId, project_id | Enables 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_url | exec | serviceId, project_id, kind | Generates 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.
| 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"}}) |
project_id | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
serviceId | string (uuid) | Service ID |
service_id | string (uuid) | Service ID (wire: serviceId) |
delete_backups | boolean | Whether to also delete the service's backups. Defaults to false. (wire: deleteBackups) |
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 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
;
Returns the PostgreSQL services of the project. (Beta version)
SELECT
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
FROM ovh.public_cloud_database.postgresqls
WHERE 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 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
;
# Description fields are for documentation purposes
- name: postgresqls
props:
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the postgresqls resource.
- name: target_spec
description: |
Desired configuration of the new service
value:
backup:
regions:
- "{{ regions }}"
time: "{{ time }}"
deletionProtected: {{ deletionProtected }}
description: "{{ description }}"
flavor: "{{ flavor }}"
forkSourceBackupId: "{{ forkSourceBackupId }}"
forkSourcePointInTime: "{{ forkSourcePointInTime }}"
forkSourceServiceId: "{{ forkSourceServiceId }}"
maintenanceWindow:
startTimeUtc: "{{ startTimeUtc }}"
network:
authorizedIps:
rules:
- cidr: "{{ cidr }}"
createdAt: "{{ createdAt }}"
description: "{{ description }}"
networkId: "{{ networkId }}"
public: {{ public }}
subnetId: "{{ subnetId }}"
nodesCount: {{ nodesCount }}
plan: "{{ plan }}"
prometheusEnabled: {{ prometheusEnabled }}
region: "{{ region }}"
storage:
size:
unit: "{{ unit }}"
value: {{ value }}
type: "{{ type }}"
version: "{{ version }}"
UPDATE examples​
- update
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​
- delete
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.
- replace
- enable_writes
- log_url
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 }}"
}'
;
Enables 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)
EXEC ovh.public_cloud_database.postgresqls.enable_writes
@serviceId='{{ serviceId }}' --required,
@project_id='{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Generates a temporary URL to read the logs of one kind. The URL expires. (Beta version)
EXEC ovh.public_cloud_database.postgresqls.log_url
@serviceId='{{ serviceId }}' --required,
@project_id='{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"kind": "{{ kind }}"
}'
;