pydo.reserved_ips.create()

Description

On creation, a reserved IP must be either assigned to a Droplet or reserved to a region.

  • To create a new reserved IP assigned to a Droplet, send a POST request to /v2/reserved_ips with the droplet_id attribute.

  • To create a new reserved IP reserved to a region, send a POST request to /v2/reserved_ips with the region attribute.

Note: In addition to the standard rate limiting, only 12 reserved IPs may be created per 60 seconds.

Request Sample

import os
from pydo import Client

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

req = {
  "droplet_id": 2457247
}

resp = client.reserved_ips.create(body=req)

Responses

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

The response will be a JSON object with a key called reserved_ip. The value of this will be an object that contains the standard attributes associated with a reserved IP. When assigning a reserved IP to a Droplet at same time as it created, the response’s links object will contain links to both the Droplet and the assignment action. The latter can be used to check the status of the action.

Click to expand an example response for reserved_ip_assigning.
{
  "summary": "Assigning to Droplet",
  "value": {
    "reserved_ip": {
      "ip": "45.55.96.47",
      "droplet": null,
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata",
          "install_agent",
          "storage",
          "image_transfer"
        ],
        "available": true,
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192g"
        ]
      },
      "locked": true,
      "project_id": "746c6152-2fa2-11ed-92d3-27aaa54e4988"
    },
    "links": {
      "droplets": [
        {
          "id": 213939433,
          "rel": "droplet",
          "href": "https://api.digitalocean.com/v2/droplets/213939433"
        }
      ],
      "actions": [
        {
          "id": 1088924622,
          "rel": "assign_ip",
          "href": "https://api.digitalocean.com/v2/actions/1088924622"
        }
      ]
    }
  }
}
Click to expand an example response for reserved_ip_reserving.
{
  "summary": "Reserving to Region",
  "value": {
    "reserved_ip": {
      "ip": "45.55.96.47",
      "droplet": null,
      "region": {
        "name": "New York 3",
        "slug": "nyc3",
        "features": [
          "private_networking",
          "backups",
          "ipv6",
          "metadata",
          "install_agent",
          "storage",
          "image_transfer"
        ],
        "available": true,
        "sizes": [
          "s-1vcpu-1gb",
          "s-1vcpu-2gb",
          "s-1vcpu-3gb",
          "s-2vcpu-2gb",
          "s-3vcpu-1gb",
          "s-2vcpu-4gb",
          "s-4vcpu-8gb",
          "s-6vcpu-16gb",
          "s-8vcpu-32gb",
          "s-12vcpu-48gb",
          "s-16vcpu-64gb",
          "s-20vcpu-96gb",
          "s-24vcpu-128gb",
          "s-32vcpu-192g"
        ]
      },
      "locked": false,
      "project_id": "746c6152-2fa2-11ed-92d3-27aaa54e4988"
    },
    "links": {}
  }
}

Unauthorized

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

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"
}