Skip to main content

database_copies

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

Overview​

Namedatabase_copies
TypeResource
Idovh.hosting_web.database_copies

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Copy id
creation_datestring (date-time)Creation date (wire: creationDate)
expiration_datestring (date-time)Expiration date (wire: expirationDate)
last_updatestring (date-time)Last update date (wire: lastUpdate)
statusstringCopy status (doing, done, error, todo)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, name, service_nameGet a database copy. Returns the status, creation date and expiration date of the copy. Restore it into the database with copyRestore.
listselectname, service_namex_pagination_modeList database copies. Returns the IDs of the copies of the database. Each copy is kept until its expiration date.
createinsertname, service_nameCreate a database copy. Creates a copy of the database, kept until its expiration date. Restore it later with copyRestore.
deletedeleteid, name, service_nameDelete a database copy. Deletes the database copy before its expiration date. The database itself is not changed.

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"}})
idstring (uuid)Copy id
namestringDatabase name (like mydb.mysql.db or mydb.postgres.db)
service_namestringThe internal name of your hosting (wire: serviceName)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Get a database copy. Returns the status, creation date and expiration date of the copy. Restore it into the database with copyRestore.

SELECT
id,
creation_date,
expiration_date,
last_update,
status
FROM ovh.hosting_web.database_copies
WHERE id = '{{ id }}' -- required
AND name = '{{ name }}' -- required
AND service_name = '{{ service_name }}' -- required
;

INSERT examples​

Create a database copy. Creates a copy of the database, kept until its expiration date. Restore it later with copyRestore.

INSERT INTO ovh.hosting_web.database_copies (
name,
service_name
)
SELECT
'{{ name }}',
'{{ service_name }}'
RETURNING
id,
creation_date,
expiration_date,
last_update,
status
;

DELETE examples​

Delete a database copy. Deletes the database copy before its expiration date. The database itself is not changed.

DELETE FROM ovh.hosting_web.database_copies
WHERE id = '{{ id }}' --required
AND name = '{{ name }}' --required
AND service_name = '{{ service_name }}' --required
;