volume_snapshots
Creates, updates, deletes, gets or lists a volume_snapshots
resource.
Overview
Name | volume_snapshots |
Type | Resource |
Id | digitalocean.compute.volume_snapshots |
Fields
The following fields are returned by SELECT
queries:
- volume_snapshots_get_by_id
- volume_snapshots_list
You will get back a JSON object that has a snapshot
key. This will contain the standard snapshot attributes
Name | Datatype | Description |
---|---|---|
id | string | The unique identifier for the snapshot. (example: 6372321) |
name | string | A human-readable name for the snapshot. (example: web-01-1595954862243) |
resource_id | string | The unique identifier for the resource that the snapshot originated from. (example: 200776916) |
created_at | string (date-time) | A time value given in ISO8601 combined date and time format that represents when the snapshot was created. (example: 2020-07-28T16:47:44Z) |
min_disk_size | integer | The minimum size in GB required for a volume or Droplet to use this snapshot. |
regions | array | An array of the regions that the snapshot is available in. The regions are represented by their identifying slug values. |
resource_type | string | The type of resource that the snapshot originated from. (example: droplet) |
size_gigabytes | number (float) | The billable size of the snapshot in gigabytes. |
tags | array | An array of Tags the snapshot has been tagged with. Requires tag:read scope. |
You will get back a JSON object that has a snapshots
key. This will be set to an array of snapshot objects, each of which contain the standard snapshot attributes
Name | Datatype | Description |
---|---|---|
id | string | The unique identifier for the snapshot. (example: 6372321) |
name | string | A human-readable name for the snapshot. (example: web-01-1595954862243) |
resource_id | string | The unique identifier for the resource that the snapshot originated from. (example: 200776916) |
created_at | string (date-time) | A time value given in ISO8601 combined date and time format that represents when the snapshot was created. (example: 2020-07-28T16:47:44Z) |
min_disk_size | integer | The minimum size in GB required for a volume or Droplet to use this snapshot. |
regions | array | An array of the regions that the snapshot is available in. The regions are represented by their identifying slug values. |
resource_type | string | The type of resource that the snapshot originated from. (example: droplet) |
size_gigabytes | number (float) | The billable size of the snapshot in gigabytes. |
tags | array | An array of Tags the snapshot has been tagged with. Requires tag:read scope. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
volume_snapshots_get_by_id | select | snapshot_id | To retrieve the details of a snapshot that has been created from a volume, send a GET request to /v2/volumes/snapshots/$VOLUME_SNAPSHOT_ID . | |
volume_snapshots_list | select | volume_id | per_page , page | To retrieve the snapshots that have been created from a volume, send a GET request to /v2/volumes/$VOLUME_ID/snapshots . |
volume_snapshots_create | insert | volume_id , data__name | To create a snapshot from a volume, sent a POST request to /v2/volumes/$VOLUME_ID/snapshots . | |
volume_snapshots_delete_by_id | delete | snapshot_id | To delete a volume snapshot, send a DELETE request to/v2/volumes/snapshots/$VOLUME_SNAPSHOT_ID .A status of 204 will be given. This indicates that the request was processed successfully, but that no response body is needed. |
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.
Name | Datatype | Description |
---|---|---|
snapshot_id | string | The unique identifier for the snapshot. (example: fbe805e8-866b-11e6-96bf-000f53315a41) |
volume_id | string (uuid) | The ID of the block storage volume. (example: 7724db7c-e098-11e5-b522-000f53304e51) |
page | integer | Which 'page' of paginated results to return. (example: 1) |
per_page | integer | Number of items returned per page (example: 2) |
SELECT
examples
- volume_snapshots_get_by_id
- volume_snapshots_list
To retrieve the details of a snapshot that has been created from a volume, send a GET request to /v2/volumes/snapshots/$VOLUME_SNAPSHOT_ID
.
SELECT
id,
name,
resource_id,
created_at,
min_disk_size,
regions,
resource_type,
size_gigabytes,
tags
FROM digitalocean.compute.volume_snapshots
WHERE snapshot_id = '{{ snapshot_id }}' -- required;
To retrieve the snapshots that have been created from a volume, send a GET request to /v2/volumes/$VOLUME_ID/snapshots
.
SELECT
id,
name,
resource_id,
created_at,
min_disk_size,
regions,
resource_type,
size_gigabytes,
tags
FROM digitalocean.compute.volume_snapshots
WHERE volume_id = '{{ volume_id }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}';
INSERT
examples
- volume_snapshots_create
- Manifest
To create a snapshot from a volume, sent a POST request to /v2/volumes/$VOLUME_ID/snapshots
.
INSERT INTO digitalocean.compute.volume_snapshots (
data__name,
data__tags,
volume_id
)
SELECT
'{{ name }}' --required,
'{{ tags }}',
'{{ volume_id }}'
RETURNING
snapshot
;
# Description fields are for documentation purposes
- name: volume_snapshots
props:
- name: volume_id
value: string (uuid)
description: Required parameter for the volume_snapshots resource.
- name: name
value: string
description: >
A human-readable name for the volume snapshot.
- name: tags
value: array
description: >
A flat array of tag names as strings to be applied to the resource. Tag names may be for either existing or new tags. <br><br>Requires `tag:create` scope.
DELETE
examples
- volume_snapshots_delete_by_id
To delete a volume snapshot, send a DELETE request to/v2/volumes/snapshots/$VOLUME_SNAPSHOT_ID
.
A status of 204 will be given. This indicates that the request was processed
successfully, but that no response body is needed.
DELETE FROM digitalocean.compute.volume_snapshots
WHERE snapshot_id = '{{ snapshot_id }}' --required;