pydo.vpcs.list_members()

Description

To list all of the resources that are members of a VPC, send a GET request to /v2/vpcs/$VPC_ID/members.

To only list resources of a specific type that are members of the VPC, included a resource_type query parameter. For example, to only list Droplets in the VPC, send a GET request to /v2/vpcs/$VPC_ID/members?resource_type=droplet.

Parameters

Name Type Required Description Default Value
vpc_id string True A unique identifier for a VPC.
resource_type string False Used to filter VPC members by a resource type.
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_members(vpc_id="e0fe0f4d")

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

Click to expand an example response.
{
  "members": [
    {
      "urn": "do:loadbalancer:fb294d78-d193-4cb2-8737-ea620993591b",
      "name": "nyc1-load-balancer-01",
      "created_at": "2020-03-13T19:30:48Z"
    },
    {
      "urn": "do:dbaas:13f7a2f6-43df-4c4a-8129-8733267ddeea",
      "name": "db-postgresql-nyc1-55986",
      "created_at": "2020-03-13T19:30:18Z"
    },
    {
      "urn": "do:kubernetes:da39d893-96e1-4e4d-971d-1fdda33a46b1",
      "name": "k8s-nyc1-1584127772221",
      "created_at": "2020-03-13T19:30:16Z"
    },
    {
      "urn": "do:droplet:86e29982-03a7-4946-8a07-a0114dff8754",
      "name": "ubuntu-s-1vcpu-1gb-nyc1-01",
      "created_at": "2020-03-13T19:29:20Z"
    }
  ],
  "links": {},
  "meta": {
    "total": 4
  }
}

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