pydo.projects.assign_resources_default()

Description

To assign resources to your default project, send a POST request to /v2/projects/default/resources.

Request Sample

import os
from pydo import Client

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

req = {
  "resources": [
    "do:droplet:13457723",
    "do:domain:example.com"
  ]
}

resp = client.projects.assign_resources_default(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 resources. The value of this will be an object with the standard resource attributes.

Click to expand an example response.
{
  "resources": [
    {
      "urn": "do:droplet:13457723",
      "assigned_at": "2018-09-28T19:26:37Z",
      "links": {
        "self": "https://api.digitalocean.com/v2/droplets/13457723"
      },
      "status": "ok"
    },
    {
      "urn": "do:domain:example.com",
      "assigned_at": "2019-03-31T16:24:14Z",
      "links": {
        "self": "https://api.digitalocean.com/v2/domains/example.com"
      },
      "status": "ok"
    }
  ]
}

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