Skip to main content

snapshots

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

Overview

Namesnapshots
TypeResource
Idgoogle.file.snapshots

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOutput only. The resource name of the snapshot, in the format projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}.
createTimestring (google-datetime)Output only. The time when the snapshot was created.
descriptionstringA description of the snapshot with 2048 characters or less. Requests with longer descriptions will be rejected.
filesystemUsedBytesstring (int64)Output only. The amount of bytes needed to allocate a full copy of the snapshot content
labelsobjectResource labels to represent user provided metadata.
statestringOutput only. The snapshot state.
tagsobjectOptional. Input only. Immutable. Tag key-value pairs bound to this resource. Each key must be a namespaced name and each value a short name. Example: "123456789012/environment" : "production", "123456789013/costCenter" : "marketing" See the documentation for more information: - Namespaced name: https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#retrieving_tag_key - Short name: https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing#retrieving_tag_value

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, instancesId, snapshotsIdGets the details of a specific snapshot.
listselectprojectsId, locationsId, instancesIdpageSize, pageToken, orderBy, filter, returnPartialSuccessLists all snapshots in a project for either a specified location or for all locations.
createinsertprojectsId, locationsId, instancesIdsnapshotIdCreates a snapshot.
patchupdateprojectsId, locationsId, instancesId, snapshotsIdupdateMaskUpdates the settings of a specific snapshot.
deletedeleteprojectsId, locationsId, instancesId, snapshotsIdDeletes a 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
instancesIdstring
locationsIdstring
projectsIdstring
snapshotsIdstring
filterstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
returnPartialSuccessboolean
snapshotIdstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets the details of a specific snapshot.

SELECT
name,
createTime,
description,
filesystemUsedBytes,
labels,
state,
tags
FROM google.file.snapshots
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND instancesId = '{{ instancesId }}' -- required
AND snapshotsId = '{{ snapshotsId }}' -- required;

INSERT examples

Creates a snapshot.

INSERT INTO google.file.snapshots (
data__description,
data__labels,
data__tags,
projectsId,
locationsId,
instancesId,
snapshotId
)
SELECT
'{{ description }}',
'{{ labels }}',
'{{ tags }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ instancesId }}',
'{{ snapshotId }}'
RETURNING
name,
done,
error,
metadata,
response
;

UPDATE examples

Updates the settings of a specific snapshot.

UPDATE google.file.snapshots
SET
data__description = '{{ description }}',
data__labels = '{{ labels }}',
data__tags = '{{ tags }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND instancesId = '{{ instancesId }}' --required
AND snapshotsId = '{{ snapshotsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
done,
error,
metadata,
response;

DELETE examples

Deletes a snapshot.

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