Skip to main content

snapshots

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

Overview

Namesnapshots
TypeResource
Idgoogle.file.snapshots

Fields

NameDatatypeDescription
namestringOutput only. The resource name of the snapshot, in the format projects/{project_id}/locations/{location_id}/instances/{instance_id}/snapshots/{snapshot_id}.
descriptionstringA description of the snapshot with 2048 characters or less. Requests with longer descriptions will be rejected.
createTimestringOutput only. The time when the snapshot was created.
filesystemUsedBytesstringOutput 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 are bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"

Methods

NameAccessible byRequired ParamsDescription
getSELECTinstancesId, locationsId, projectsId, snapshotsIdGets the details of a specific snapshot.
listSELECTinstancesId, locationsId, projectsIdLists all snapshots in a project for either a specified location or for all locations.
createINSERTinstancesId, locationsId, projectsIdCreates a snapshot.
deleteDELETEinstancesId, locationsId, projectsId, snapshotsIdDeletes a snapshot.
patchUPDATEinstancesId, locationsId, projectsId, snapshotsIdUpdates the settings of a specific snapshot.

SELECT examples

Lists all snapshots in a project for either a specified location or for all locations.

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

INSERT example

Use the following StackQL query and manifest file to create a new snapshots resource.

/*+ create */
INSERT INTO google.file.snapshots (
instancesId,
locationsId,
projectsId,
description,
labels,
tags
)
SELECT
'{{ instancesId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ description }}',
'{{ labels }}',
'{{ tags }}'
;

UPDATE example

Updates a snapshots resource.

/*+ update */
UPDATE google.file.snapshots
SET
description = '{{ description }}',
labels = '{{ labels }}',
tags = '{{ tags }}'
WHERE
instancesId = '{{ instancesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND snapshotsId = '{{ snapshotsId }}';

DELETE example

Deletes the specified snapshots resource.

/*+ delete */
DELETE FROM google.file.snapshots
WHERE instancesId = '{{ instancesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND snapshotsId = '{{ snapshotsId }}';