The following actions are available on an Image.
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
.
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.
Name | Type | Required | Description | Default Value |
---|---|---|---|---|
image_id |
integer | True | A unique number that can be used to identify and reference a specific image. | |
body |
JSON or IO[bytes] | False |
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
req = {
"type": "convert"
}
resp = client.image_actions.post(image_id=342341, body=req)
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.