Python SDK

The Lightning Cloud Python SDK, vpcloud_client, covers the whole public API: fleets, nodes, Managed Kubernetes, storage, health, and the Observability API. It gets and refreshes tokens for you from an Application Principal's client ID and secret, so your code never handles one.

Install

Python 3.9 or later. Install into a virtual environment, because many systems refuse a system-wide pip install.

git clone https://github.com/voltagepark/vp-cloud-sdk.git
cd vp-cloud-sdk
python3 -m venv .venv
source .venv/bin/activate
pip install .

Or with uv: uv sync && source .venv/bin/activate.

Configure

Export your Application Principal's credentials. Keep the secret in a secrets manager, not in source control.

export VPCLOUD_CLIENT_ID=<client id>
export VPCLOUD_CLIENT_SECRET=<client secret>
import vpcloud_client

configuration = vpcloud_client.Configuration()                                       # sea1
# configuration = vpcloud_client.Configuration(host="https://api.iad1.voltagepark.com")  # another region
Setting Default Controls
host https://api.sea1.voltagepark.com The regional API endpoint for fleets, nodes, Kubernetes, and storage
observatory_host (or VPCLOUD_OBSERVATORY_HOST) https://observatory.voltagepark.com The Observability API endpoint

The SDK keeps a separate token for each API and sends each request the right one. A token is never sent to an API it wasn't issued for.

First calls

with vpcloud_client.ApiClient(configuration) as api_client:
    for fleet in vpcloud_client.FleetsApi(api_client).list_fleets().fleets:
        print(fleet.fleet_id, fleet.name, fleet.status)

    for cluster in vpcloud_client.ClustersApi(api_client).resolve_clusters().clusters or []:
        print(cluster.cluster_id, cluster.metrics_ready, cluster.logs_ready)

What's in the SDK

Module Covers Guide
FleetsApi, NodesApi, NodeOperationsApi, SSHKeysApi Fleets, fleet history and health, nodes, node power, SSH keys Fleets, Nodes, Fleet health, SSH keys
KubernetesApi, StorageApi, FleetOperationsApi Managed Kubernetes clusters and worker maintenance, storage views Managed Kubernetes, Storage views
MonitoringApi, ClusterValidationApi, AuditApi Monitoring dashboards, cluster validation, your account's audit log Monitoring dashboards, Cluster validation, Audit logs
MetricsApi PromQL for one cluster or your organization Metrics
LogsApi LogsQL over a cluster's logs Logs
KubernetesAuditApi A cluster's Kubernetes audit log Kubernetes audit
ClustersApi Your clusters and the endpoint that serves each Find your clusters
vpcloud_client.results decode_result turns metrics responses into series and samples; decode_json_lines decodes log lines and audit events Metrics
vpcloud_client.streaming watch and tail (and awatch, atail for asyncio) follow metrics and logs live Streaming metrics, Tailing logs

Every *Api method has a *_with_http_info variant that also returns the status code and headers. Errors raise vpcloud_client.rest.ApiException, with status and the response body.

Was this page helpful?

What went wrong?

↑↓ Navigate↵ Open⌘↵ New tabesc Close