Skip to main content

snapshots

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

Overview

Namesnapshots
TypeResource
Idgoogle.baremetalsolution.snapshots

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringOutput only. An identifier for the snapshot, generated by the backend.
namestringThe name of the snapshot.
createTimestring (google-datetime)Output only. The creation time of the snapshot.
descriptionstringThe description of the snapshot.
storageVolumestringOutput only. The name of the volume which this snapshot belongs to.
typestringOutput only. The type of the snapshot which indicates whether it was scheduled or manual/ad-hoc.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, volumesId, snapshotsIdReturns the specified snapshot resource. Returns INVALID_ARGUMENT if called for a non-boot volume.
listselectprojectsId, locationsId, volumesIdpageSize, pageTokenRetrieves the list of snapshots for the specified volume. Returns a response with an empty list of snapshots if called for a non-boot volume.
createinsertprojectsId, locationsId, volumesIdTakes a snapshot of a boot volume. Returns INVALID_ARGUMENT if called for a non-boot volume.
deletedeleteprojectsId, locationsId, volumesId, snapshotsIdDeletes a volume snapshot. Returns INVALID_ARGUMENT if called for a non-boot volume.
restore_volume_snapshotexecprojectsId, locationsId, volumesId, snapshotsIdUses the specified snapshot to restore its parent volume. Returns INVALID_ARGUMENT if called for a non-boot volume.

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
locationsIdstring
projectsIdstring
snapshotsIdstring
volumesIdstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Returns the specified snapshot resource. Returns INVALID_ARGUMENT if called for a non-boot volume.

SELECT
id,
name,
createTime,
description,
storageVolume,
type
FROM google.baremetalsolution.snapshots
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND volumesId = '{{ volumesId }}' -- required
AND snapshotsId = '{{ snapshotsId }}' -- required;

INSERT examples

Takes a snapshot of a boot volume. Returns INVALID_ARGUMENT if called for a non-boot volume.

INSERT INTO google.baremetalsolution.snapshots (
data__name,
data__description,
projectsId,
locationsId,
volumesId
)
SELECT
'{{ name }}',
'{{ description }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ volumesId }}'
RETURNING
id,
name,
createTime,
description,
storageVolume,
type
;

DELETE examples

Deletes a volume snapshot. Returns INVALID_ARGUMENT if called for a non-boot volume.

DELETE FROM google.baremetalsolution.snapshots
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND volumesId = '{{ volumesId }}' --required
AND snapshotsId = '{{ snapshotsId }}' --required;

Lifecycle Methods

Uses the specified snapshot to restore its parent volume. Returns INVALID_ARGUMENT if called for a non-boot volume.

EXEC google.baremetalsolution.snapshots.restore_volume_snapshot 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@volumesId='{{ volumesId }}' --required,
@snapshotsId='{{ snapshotsId }}' --required;