Skip to main content

file_snapshots

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

Overview​

Namefile_snapshots
TypeResource
Idovh.public_cloud_storage.file_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 observed state of the snapshot from the infrastructure (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 and its current state, including its size and source file storage.
listselectproject_idx_pagination_cursor, x_pagination_size, share_idReturns the file storage snapshots of the project.
createinsertproject_id, target_specCreates a snapshot of a file storage. A new file storage can then be created from it.
updateupdatesnapshot_id, project_id, target_specUpdates the snapshot name and description. Send the current checksum to prevent overwriting a concurrent change.
deletedeletesnapshot_id, project_idDeletes the snapshot.

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)
share_idstring (uuid)Filter by source file storage ID (wire: shareId)
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the snapshot and its current state, including its size and source file storage.

SELECT
id,
checksum,
created_at,
current_state,
current_tasks,
resource_status,
target_spec,
updated_at
FROM ovh.public_cloud_storage.file_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 of a file storage. A new file storage can then be created from it.

INSERT INTO ovh.public_cloud_storage.file_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
;

UPDATE examples​

Updates the snapshot name and description. Send the current checksum to prevent overwriting a concurrent change.

UPDATE ovh.public_cloud_storage.file_snapshots
SET
checksum = '{{ checksum }}',
target_spec = '{{ target_spec }}'
WHERE
snapshot_id = '{{ snapshot_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 snapshot.

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