Skip to main content

volume_actions

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

Overview

Namevolume_actions
TypeResource
Iddigitalocean.compute.volume_actions

Fields

The following fields are returned by SELECT queries:

The response will be an object with a key called action. The value of this will be an object that contains the standard volume action attributes

NameDatatypeDescription
idintegerA unique numeric ID that can be used to identify and reference an action.
resource_idintegerA unique identifier for the resource that the action is associated with.
completed_atstring (date-time)A time value given in ISO8601 combined date and time format that represents when the action was completed. (example: 2020-11-14T16:30:06Z)
regionobject
region_slugstringA human-readable string that is used as a unique identifier for each region. (example: nyc3)
resource_typestringThe type of resource that the action is associated with. (example: droplet)
started_atstring (date-time)A time value given in ISO8601 combined date and time format that represents when the action was initiated. (example: 2020-11-14T16:29:21Z)
statusstringThe current status of the action. This can be "in-progress", "completed", or "errored". (example: completed, default: in-progress)
typestringThis is the type of action that the object represents. For example, this could be "transfer" to represent the state of an image transfer action. (example: create)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
volume_actions_getselectvolume_id, action_idper_page, pageTo retrieve the status of a volume action, send a GET request to /v2/volumes/$VOLUME_ID/actions/$ACTION_ID.

volume_actions_listselectvolume_idper_page, pageTo retrieve all actions that have been executed on a volume, send a GET request to /v2/volumes/$VOLUME_ID/actions.

volume_actions_post_by_idexecvolume_idper_page, pageTo initiate an action on a block storage volume by Id, send a POST request to
~/v2/volumes/$VOLUME_ID/actions. The body should contain the appropriate
attributes for the respective action.

## Attach a Block Storage Volume to a Droplet

| Attribute | Details |
| ---------- | ------------------------------------------------------------------- |
| type | This must be attach |
| droplet_id | Set to the Droplet's ID |
| region | Set to the slug representing the region where the volume is located |

Each volume may only be attached to a single Droplet. However, up to fifteen
volumes may be attached to a Droplet at a time. Pre-formatted volumes will be
automatically mounted to Ubuntu, Debian, Fedora, Fedora Atomic, and CentOS
Droplets created on or after April 26, 2018 when attached. On older Droplets,
additional configuration
is required.

## Remove a Block Storage Volume from a Droplet

| Attribute | Details |
| ---------- | ------------------------------------------------------------------- |
| type | This must be detach |
| droplet_id | Set to the Droplet's ID |
| region | Set to the slug representing the region where the volume is located |

## Resize a Volume

| Attribute | Details |
| -------------- | ------------------------------------------------------------------- |
| type | This must be resize |
| size_gigabytes | The new size of the block storage volume in GiB (1024^3) |
| region | Set to the slug representing the region where the volume is located |

Volumes may only be resized upwards. The maximum size for a volume is 16TiB.

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
action_idintegerA unique numeric ID that can be used to identify and reference an action. (example: 36804636)
volume_idstring (uuid)The ID of the block storage volume. (example: 7724db7c-e098-11e5-b522-000f53304e51)
pageintegerWhich 'page' of paginated results to return. (example: 1)
per_pageintegerNumber of items returned per page (example: 2)

SELECT examples

To retrieve the status of a volume action, send a GET request to /v2/volumes/$VOLUME_ID/actions/$ACTION_ID.

SELECT
id,
resource_id,
completed_at,
region,
region_slug,
resource_type,
started_at,
status,
type
FROM digitalocean.compute.volume_actions
WHERE volume_id = '{{ volume_id }}' -- required
AND action_id = '{{ action_id }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}';

Lifecycle Methods

To initiate an action on a block storage volume by Id, send a POST request to
~/v2/volumes/$VOLUME_ID/actions. The body should contain the appropriate
attributes for the respective action.

## Attach a Block Storage Volume to a Droplet

| Attribute | Details |
| ---------- | ------------------------------------------------------------------- |
| type | This must be attach |
| droplet_id | Set to the Droplet's ID |
| region | Set to the slug representing the region where the volume is located |

Each volume may only be attached to a single Droplet. However, up to fifteen
volumes may be attached to a Droplet at a time. Pre-formatted volumes will be
automatically mounted to Ubuntu, Debian, Fedora, Fedora Atomic, and CentOS
Droplets created on or after April 26, 2018 when attached. On older Droplets,
additional configuration
is required.

## Remove a Block Storage Volume from a Droplet

| Attribute | Details |
| ---------- | ------------------------------------------------------------------- |
| type | This must be detach |
| droplet_id | Set to the Droplet's ID |
| region | Set to the slug representing the region where the volume is located |

## Resize a Volume

| Attribute | Details |
| -------------- | ------------------------------------------------------------------- |
| type | This must be resize |
| size_gigabytes | The new size of the block storage volume in GiB (1024^3) |
| region | Set to the slug representing the region where the volume is located |

Volumes may only be resized upwards. The maximum size for a volume is 16TiB.

EXEC digitalocean.compute.volume_actions.volume_actions_post_by_id 
@volume_id='{{ volume_id }}' --required,
@per_page='{{ per_page }}',
@page='{{ page }}';