volume_actions
Creates, updates, deletes, gets or lists a volume_actions
resource.
Overview
Name | volume_actions |
Type | Resource |
Id | digitalocean.compute.volume_actions |
Fields
The following fields are returned by SELECT
queries:
- volume_actions_get
- volume_actions_list
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
Name | Datatype | Description |
---|---|---|
id | integer | A unique numeric ID that can be used to identify and reference an action. |
resource_id | integer | A unique identifier for the resource that the action is associated with. |
completed_at | string (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) |
region | object | |
region_slug | string | A human-readable string that is used as a unique identifier for each region. (example: nyc3) |
resource_type | string | The type of resource that the action is associated with. (example: droplet) |
started_at | string (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) |
status | string | The current status of the action. This can be "in-progress", "completed", or "errored". (example: completed, default: in-progress) |
type | string | This 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) |
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.
Name | Datatype | Description |
---|---|---|
id | integer | A unique numeric ID that can be used to identify and reference an action. |
resource_id | integer | A unique identifier for the resource that the action is associated with. |
completed_at | string (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) |
region | object | |
region_slug | string | A human-readable string that is used as a unique identifier for each region. (example: nyc3) |
resource_type | string | The type of resource that the action is associated with. (example: droplet) |
started_at | string (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) |
status | string | The current status of the action. This can be "in-progress", "completed", or "errored". (example: completed, default: in-progress) |
type | string | This 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:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
volume_actions_get | select | volume_id , action_id | per_page , page | To retrieve the status of a volume action, send a GET request to /v2/volumes/$VOLUME_ID/actions/$ACTION_ID . |
volume_actions_list | select | volume_id | per_page , page | To retrieve all actions that have been executed on a volume, send a GET request to /v2/volumes/$VOLUME_ID/actions . |
volume_actions_post_by_id | exec | volume_id | per_page , page | 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 appropriateattributes 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.
Name | Datatype | Description |
---|---|---|
action_id | integer | A unique numeric ID that can be used to identify and reference an action. (example: 36804636) |
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_actions_get
- volume_actions_list
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 }}';
To retrieve all actions that have been executed on a volume, send a GET request to /v2/volumes/$VOLUME_ID/actions
.
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 per_page = '{{ per_page }}'
AND page = '{{ page }}';
Lifecycle Methods
- volume_actions_post_by_id
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 }}';