pydo.kubernetes.destroy_associated_resources_selective()

Description

To delete a Kubernetes cluster along with a subset of its associated resources, send a DELETE request to /v2/kubernetes/clusters/$K8S_CLUSTER_ID/destroy_with_associated_resources/selective.

The JSON body of the request should include load_balancers, volumes, or volume_snapshots keys each set to an array of IDs for the associated resources to be destroyed.

The IDs can be found by querying the cluster’s associated resources endpoint. Any associated resource not included in the request will remain and continue to accrue changes on your account.

Parameters

Name Type Required Description Default Value
cluster_id string True A unique ID that can be used to reference a Kubernetes cluster.
body JSON or IO[bytes] True

Request Sample

import os
from pydo import Client

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

req = {
  "load_balancers": [
    "4de7ac8b-495b-4884-9a69-1050c6793cd6"
  ],
  "volumes": [
    "ba49449a-7435-11ea-b89e-0a58ac14480f"
  ],
  "volume_snapshots": [
    "edb0478d-7436-11ea-86e6-0a58ac144b91"
  ]
}

resp = client.kubernetes.destroy_associated_resources_selective(cluster_id="da8fda8", body=req)

Responses

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

The action was successful and the response body is empty.

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