pydo.vpcs.list()

Description

To list all of the VPCs on your account, send a GET request to /v2/vpcs.

Parameters

Name Type Required Description Default Value
per_page integer False Number of items returned per page 20
page integer False Which ‘page’ of paginated results to return. 1

Request Sample

import os
from pydo import Client

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

resp = client.vpcs.list()

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 vpcs. This will be set to an array of objects, each of which will contain the standard attributes associated with a VPC

Click to expand an example response.
{
  "vpcs": [
    {
      "name": "env.prod-vpc",
      "description": "VPC for production environment",
      "region": "nyc1",
      "ip_range": "10.10.10.0/24",
      "id": "5a4981aa-9653-4bd1-bef5-d6bff52042e4",
      "urn": "do:vpc:5a4981aa-9653-4bd1-bef5-d6bff52042e4",
      "default": false,
      "created_at": "2020-03-13T19:20:47.442049222Z"
    },
    {
      "id": "e0fe0f4d-596a-465e-a902-571ce57b79fa",
      "urn": "do:vpc:e0fe0f4d-596a-465e-a902-571ce57b79fa",
      "name": "default-nyc1",
      "description": "",
      "region": "nyc1",
      "ip_range": "10.102.0.0/20",
      "created_at": "2020-03-13T19:29:20Z",
      "default": true
    },
    {
      "id": "d455e75d-4858-4eec-8c95-da2f0a5f93a7",
      "urn": "do:vpc:d455e75d-4858-4eec-8c95-da2f0a5f93a7",
      "name": "default-nyc3",
      "description": "",
      "region": "nyc3",
      "ip_range": "10.100.0.0/20",
      "created_at": "2019-11-19T22:19:35Z",
      "default": true
    }
  ],
  "links": {},
  "meta": {
    "total": 3
  }
}

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