pydo.volume_snapshots.create()

Description

To create a snapshot from a volume, sent a POST request to /v2/volumes/$VOLUME_ID/snapshots.

Parameters

Name Type Required Description Default Value
volume_id string True The ID of the block storage volume.
body JSON or IO[bytes] True

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "name": "big-data-snapshot1475261774"
}

resp = client.volume_snapshots.create(volume_id="da3aa3a", body=req)

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

You will get back a JSON object that has a snapshot key. This will contain the standard snapshot attributes

Click to expand an example response.
{
  "snapshot": {
    "id": "8fa70202-873f-11e6-8b68-000f533176b1",
    "name": "big-data-snapshot1475261774",
    "regions": [
      "nyc1"
    ],
    "created_at": "2020-09-30T18:56:14Z",
    "resource_id": "82a48a18-873f-11e6-96bf-000f53315a41",
    "resource_type": "volume",
    "min_disk_size": 10,
    "size_gigabytes": 10,
    "tags": [
      "aninterestingtag"
    ]
  }
}

Bad Request

Click to expand an example response.
{
  "id": "bad_request",
  "message": "error parsing request body",
  "request_id": "4851a473-1621-42ea-b2f9-5071c0ea8414"
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

The resource was not found.

Click to expand an example response.
{
  "id": "not_found",
  "message": "The resource you requested could not be found."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}