Skip to main content

image_actions

Creates, updates, deletes, gets or lists an image_actions resource.

Overview

Nameimage_actions
TypeResource
Iddigitalocean.compute.image_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 image 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
image_actions_getselectimage_id, action_idTo retrieve the status of an image action, send a GET request to /v2/images/$IMAGE_ID/actions/$IMAGE_ACTION_ID.
image_actions_listselectimage_idTo retrieve all actions that have been executed on an image, send a GET request to /v2/images/$IMAGE_ID/actions.
image_actions_postexecimage_idThe 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 set
region attribute to the slug identifier of the region you wish to transfer
to.

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)
image_idintegerA unique number that can be used to identify and reference a specific image. (example: 62137902)

SELECT examples

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;

Lifecycle Methods

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 set
region 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;