Skip to main content

compute_snapshots

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

Overview​

Namecompute_snapshots
TypeResource
Idovh.public_cloud.compute_snapshots

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Unique identifier of the snapshot
checksumstringComputed hash representing the current target specification value
created_atstring (date-time)Creation date of the snapshot (wire: createdAt)
current_stateobjectCurrent state of the snapshot (wire: currentState)
current_tasksarrayOngoing asynchronous tasks related to the snapshot (wire: currentTasks)
resource_statusstringSnapshot readiness in the system (CREATING, CREATION_PLANNED, DELETING, ERROR, OUT_OF_SYNC, READY, SUSPENDED, UNKNOWN, UPDATING) (wire: resourceStatus)
target_specobjectLast target specification of the snapshot (wire: targetSpec)
updated_atstring (date-time)Last update date of the snapshot (wire: updatedAt)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsnapshot_id, project_idReturns the snapshot image, including its status and the instance it was created from.
listselectproject_idx_pagination_cursor, x_pagination_size, instance_idReturns the snapshots of the project.
createinsertproject_id, target_specCreates a snapshot image of the instance's current disk. Its id can be used as image.id to create a new instance from it.
deletedeletesnapshot_id, project_idDeletes the snapshot image.

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.
snapshot_idstring (uuid)Snapshot ID (wire: snapshotId)
instance_idstring (uuid)Filter by source instance ID (wire: instanceId)
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the snapshot image, including its status and the instance it was created from.

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

INSERT examples​

Creates a snapshot image of the instance's current disk. Its id can be used as image.id to create a new instance from it.

INSERT INTO ovh.public_cloud.compute_snapshots (
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
;

DELETE examples​

Deletes the snapshot image.

DELETE FROM ovh.public_cloud.compute_snapshots
WHERE snapshot_id = '{{ snapshot_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;