image_actions
Creates, updates, deletes, gets or lists an image_actions
resource.
Overview
Name | image_actions |
Type | Resource |
Id | digitalocean.compute.image_actions |
Fields
The following fields are returned by SELECT
queries:
- image_actions_get
- image_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 image 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 results will be returned as a JSON object with an actions
key. This will be set to an array filled with action objects containing the standard 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 |
---|---|---|---|---|
image_actions_get | select | image_id , action_id | To retrieve the status of an image action, send a GET request to /v2/images/$IMAGE_ID/actions/$IMAGE_ACTION_ID . | |
image_actions_list | select | image_id | To retrieve all actions that have been executed on an image, send a GET request to /v2/images/$IMAGE_ID/actions . | |
image_actions_post | exec | image_id | The following actions are available on an Image. ## Convert an Image to a Snapshot To convert an image, for example, a backup to a snapshot, send a POST request to /v2/images/$IMAGE_ID/actions . Set the type attribute to convert .## Transfer an Image To transfer an image to another region, send a POST request to /v2/images/$IMAGE_ID/actions . Set the type attribute to transfer and setregion attribute to the slug identifier of the region you wish to transferto. |
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) |
image_id | integer | A unique number that can be used to identify and reference a specific image. (example: 62137902) |
SELECT
examples
- image_actions_get
- image_actions_list
To retrieve the status of an image action, send a GET request to /v2/images/$IMAGE_ID/actions/$IMAGE_ACTION_ID
.
SELECT
id,
resource_id,
completed_at,
region,
region_slug,
resource_type,
started_at,
status,
type
FROM digitalocean.compute.image_actions
WHERE image_id = '{{ image_id }}' -- required
AND action_id = '{{ action_id }}' -- required;
To retrieve all actions that have been executed on an image, send a GET request to /v2/images/$IMAGE_ID/actions
.
SELECT
id,
resource_id,
completed_at,
region,
region_slug,
resource_type,
started_at,
status,
type
FROM digitalocean.compute.image_actions
WHERE image_id = '{{ image_id }}' -- required;
Lifecycle Methods
- image_actions_post
The following actions are available on an Image.
## Convert an Image to a Snapshot
To convert an image, for example, a backup to a snapshot, send a POST request
to /v2/images/$IMAGE_ID/actions
. Set the type
attribute to convert
.
## Transfer an Image
To transfer an image to another region, send a POST request to/v2/images/$IMAGE_ID/actions
. Set the type
attribute to transfer
and setregion
attribute to the slug identifier of the region you wish to transfer
to.
EXEC digitalocean.compute.image_actions.image_actions_post
@image_id='{{ image_id }}' --required;