Bare metal GPU fleet provisioning and management.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.0
- Package version: 3.1.1
- Generator version: 7.16.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 3.9+
The SDK is not published on PyPI; install it from this repository.
Clone the repository and install it into a virtual environment:
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, from the clone:
uv sync
source .venv/bin/activateEach release is tagged. To install one into your own virtual environment without cloning:
pip install "git+https://github.com/voltagepark/vp-cloud-sdk@v3.1.1"Then import the package:
import vpcloud_clientExecute pytest to run the tests.
Before using the SDK, you need to export the following environment variables:
export VPCLOUD_CLIENT_ID=
export VPCLOUD_CLIENT_SECRET=
export VPCLOUD_REGION= # where your fleets are: sea1, iad1, dfw2 or ord1Each region has its own API endpoint and tokens. VPCLOUD_REGION (or
Configuration(region=...), or region in your ~/.voltagepark/credentials
profile) picks both. Fleets, nodes, Kubernetes, storage, SSH keys, audit and the
other regional APIs fail with a ValueError until a region is set; MetricsApi,
LogsApi, KubernetesAuditApi and ClustersApi don't need one. If your
application has no access to the region, calls raise AuthenticationError
naming it, before any request is sent.
The region also picks the Observability endpoint for per-cluster metrics, logs,
audit and streaming, because each region's endpoint serves only that region's
clusters: sea1, dfw2 and ord1 use
https://<region>.observatory.voltagepark.com, and iad1 (or no region) uses
https://observatory.voltagepark.com. Org-wide metrics and streaming without a
cluster use the main endpoint for sea1 and dfw2. observatory_host= (or
VPCLOUD_OBSERVATORY_HOST) overrides both endpoints. An unknown region in
VPCLOUD_REGION or the credentials file never breaks these APIs; they use the
main endpoint.
host= replaces the API endpoint, for example with a proxy. Pass region= with
it so the SDK knows which region's token to get; on its own, host must be a
regional endpoint such as https://api.iad1.voltagepark.com.
Tokens come from the production Voltage Park tenant, so the SDK calls the production APIs.
Configuration()no longer defaults to sea1. SetVPCLOUD_REGIONor passregion=for fleets, nodes, Kubernetes, storage, SSH keys, audit, monitoring and cluster validation.- Reading
configuration.hostwith no region set raisesValueError. - A failed client ID/secret exchange raises
AuthenticationErrorinstead of falling back to the credentials file'saccess_token. host=with an endpoint that isn't a regional one needsregion=too. Before, it quietly got a sea1 token.Auth0TokenManagertakes an explicitaudience; itshostargument is gone.
Please follow the installation procedure and then run the following:
import os
import json
import vpcloud_client
from vpcloud_client.rest import ApiException
# Authenticate with your Application Principal's client ID and secret
# The SDK will automatically exchange these for an access token
# region is where your fleets are: sea1, iad1, dfw2 or ord1
# See configuration.py for a list of all supported configuration parameters.
configuration = vpcloud_client.Configuration(
region = os.environ.get("VPCLOUD_REGION"),
client_id = os.environ["VPCLOUD_CLIENT_ID"],
client_secret = os.environ["VPCLOUD_CLIENT_SECRET"]
)
# Enter a context with an instance of the API client
with vpcloud_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = vpcloud_client.FleetsApi(api_client)
try:
# List your fleets
api_response = api_instance.list_fleets()
print("The response of FleetsApi->list_fleets:\n")
# Convert response to dict for cleaner output
print(json.dumps(api_response.model_dump(mode="json"), indent=2))
except ApiException as e:
print("Exception when calling FleetsApi->list_fleets: %s\n" % e)Save this example to a file (e.g., example.py) and run it with:
source .venv/bin/activate
python3 example.pyHarbor API URIs are relative to your region's API endpoint (for example https://api.iad1.voltagepark.com). Per-cluster MetricsApi, LogsApi and KubernetesAuditApi calls and ClustersApi calls use observatory_host: https://<region>.observatory.voltagepark.com for sea1, dfw2 and ord1, else https://observatory.voltagepark.com. Org-wide MetricsApi calls use observatory_org_host, which stays on https://observatory.voltagepark.com for sea1 and dfw2.
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AuditApi | get_audit_log_export | GET /v1/audit-logs/export | Check the 90-day audit log export and get its download URL |
| AuditApi | get_audit_logs | GET /v1/audit-logs | List recent audit logs for your organization |
| AuditApi | start_audit_log_export | POST /v1/audit-logs/export | Start building the 90-day audit log export for your organization |
| ClusterValidationApi | get_cluster_validation_detail | GET /v1/fleets/{fleetId}/cluster-validation/{validationId}/details | Get cluster validation run details |
| ClusterValidationApi | get_cluster_validation_report | GET /v1/fleets/{fleetId}/cluster-validation/{validationId}/report | Get cluster validation run report |
| ClusterValidationApi | list_cluster_validation_tests | GET /v1/fleets/{fleetId}/cluster-validation/tests | List available cluster validation tests |
| ClusterValidationApi | list_cluster_validations | GET /v1/fleets/{fleetId}/cluster-validation | List recent cluster validation runs |
| ClusterValidationApi | trigger_cluster_validation | POST /v1/fleets/{fleetId}/cluster-validation | Start a cluster validation run |
| ClustersApi | resolve_clusters | GET /v1/clusters | List your clusters |
| FleetOperationsApi | modify_fleet_storage | POST /v1/fleets/{fleetId}/storage/modify | Resize fleet storage |
| FleetsApi | get_fleet | GET /v1/fleets/{fleetId} | Get fleet details |
| FleetsApi | get_fleet_health | GET /v1/fleets/{fleetId}/health | Get fleet health metrics |
| FleetsApi | get_fleet_history | GET /v1/fleets/{fleetId}/history | Get fleet event history |
| FleetsApi | list_fleets | GET /v1/fleets | List your fleets |
| KubernetesApi | cordon_customer_mks2_worker_node | POST /v1/fleets/{fleetId}/kubernetes-v2/nodes/{nodeId}/cordon | Cordon a managed Kubernetes worker node |
| KubernetesApi | drain_customer_mks2_worker_node | POST /v1/fleets/{fleetId}/kubernetes-v2/nodes/{nodeId}/drain | Drain a managed Kubernetes worker node |
| KubernetesApi | get_customer_mks2_cluster_health | GET /v1/fleets/{fleetId}/kubernetes-v2/health | Get managed Kubernetes cluster health |
| KubernetesApi | get_customer_mks2_kubeconfig | GET /v1/fleets/{fleetId}/kubernetes-v2/kubeconfig | Download customer managed Kubernetes kubeconfig |
| KubernetesApi | get_customer_mks2_worker_node | GET /v1/fleets/{fleetId}/kubernetes-v2/nodes/{nodeId} | Get managed Kubernetes worker node detail |
| KubernetesApi | uncordon_customer_mks2_worker_node | POST /v1/fleets/{fleetId}/kubernetes-v2/nodes/{nodeId}/uncordon | Uncordon a managed Kubernetes worker node |
| KubernetesAuditApi | cancel_audit_query | POST /v1/clusters/{cluster_id}/audit/queries/{query_id}/cancel | Cancel an audit log query |
| KubernetesAuditApi | create_audit_query | POST /v1/clusters/{cluster_id}/audit/queries | Start an audit log query |
| KubernetesAuditApi | get_audit_coverage | GET /v1/clusters/{cluster_id}/audit/coverage | Get audit log coverage |
| KubernetesAuditApi | get_audit_query | GET /v1/clusters/{cluster_id}/audit/queries/{query_id} | Get an audit log query |
| KubernetesAuditApi | get_audit_query_results | GET /v1/clusters/{cluster_id}/audit/queries/{query_id}/results | Read audit log query results |
| LogsApi | query_logs | POST /v1/clusters/{cluster_id}/logs/query | Query logs |
| MetricsApi | query_metrics | POST /v1/clusters/{cluster_id}/query | Run an instant PromQL query |
| MetricsApi | query_metrics_range | POST /v1/clusters/{cluster_id}/query_range | Run a range PromQL query |
| MetricsApi | query_org_metrics | POST /v1/query | Run an instant PromQL query across your organization |
| MetricsApi | query_org_metrics_range | POST /v1/query_range | Run a range PromQL query across your organization |
| MonitoringApi | get_fleet_grafana_dashboards | GET /v1/fleets/{fleetId}/services/grafana | Get Grafana dashboards for a specific fleet |
| NodeOperationsApi | create_node_power_operation | POST /v1/fleets/{fleetId}/nodes/{nodeId}/power | Queue a node power operation |
| NodesApi | get_fleet_node_details | GET /v1/fleets/{fleetId}/nodes/{nodeId}/details | Get consolidated node details |
| NodesApi | get_node_by_fleet_id | GET /v1/fleets/{fleetId}/nodes/{nodeId} | Get node details |
| NodesApi | get_node_power_state | GET /v1/fleets/{fleetId}/nodes/{nodeId}/power | Get node power state |
| NodesApi | list_nodes_by_fleet_id | GET /v1/fleets/{fleetId}/nodes | List nodes in a fleet |
| SSHKeysApi | add_fleet_ssh_key | POST /v1/fleets/{fleetId}/sshkeys | Apply an SSH key to a running fleet |
| SSHKeysApi | create_ssh_key | POST /v1/sshkeys | Add an SSH key |
| SSHKeysApi | delete_ssh_key | DELETE /v1/sshkeys/{sshKeyId} | Remove an SSH key |
| SSHKeysApi | list_ssh_keys | GET /v1/sshkeys | List your SSH keys |
| SSHKeysApi | remove_fleet_ssh_key | DELETE /v1/fleets/{fleetId}/sshkeys/{sshKeyId} | Revoke an SSH key from a running fleet |
| StorageApi | add_storage_view | POST /v1/fleets/{fleetId}/storage/views | Add a VAST storage view |
| StorageApi | delete_storage_view | DELETE /v1/fleets/{fleetId}/storage/views/{view} | Delete a VAST storage view |
| StorageApi | get_storage_view | GET /v1/fleets/{fleetId}/storage/views/{view} | Get a VAST storage view |
| StorageApi | list_storage_views | GET /v1/fleets/{fleetId}/storage/views | List VAST storage views |
| StorageApi | update_storage_view | PATCH /v1/fleets/{fleetId}/storage/views/{view} | Update a VAST storage view |
- AddFleetSSHKeyRequest
- AddFleetSSHKeyResponse
- AddStorageViewRequest
- AuditLogEntry
- AuditLogExportStatusResponse
- AuditLogListResponse
- Bootstrap
- ClusterValidationDetail
- ClusterValidationListResponse
- ClusterValidationResponse
- CreateAuditQueryRequest
- CreateSSHKeyRequest
- CustomerTriggerClusterValidationRequest
- ErrorResponse
- ExpandableCapacity
- ExpandableNodeSpec
- ExternalStorageConfig
- Fleet
- FleetApps
- FleetAppsMks2Cluster
- FleetAppsMks2NodeCounts
- FleetAppsMksCluster
- FleetComputeFootprint
- FleetHealthResponse
- FleetHistoryEvent
- FleetHistoryResponse
- FleetManagedBy
- FleetNode
- FleetNodeSpec
- FleetStatus
- GetFleetHealth422Response
- GoogleRpcCode
- GrafanaDashboardResponse
- Infrastructure
- InfrastructureNetwork
- KubeconfigV2Response
- KubernetesServiceLinks
- ListFleetsResponse
- ListNodesResponse
- LogsQueryRequest
- Mks2AddonsHealth
- Mks2ClusterHealth
- Mks2ComponentHealth
- Mks2ControlPlaneHealth
- Mks2CordonNodeResponse
- Mks2DrainNodeRequest
- Mks2DrainNodeResponse
- Mks2GpuInfo
- Mks2HealthStatus
- Mks2NetworkHealth
- Mks2NodeAlertSuppression
- Mks2NodeCondition
- Mks2NodeHealth
- Mks2NodeMaintenance
- Mks2NodeTaint
- Mks2WorkerNodeDetail
- Mks2WorkerNodeKubernetesStatus
- Mks2WorkerNodeRegistrationStatus
- ModifyStorageRequest
- ModifyStorageRequestStorageViewsInner
- ModifyStorageResponse
- Node
- NodeDetails
- NodeHealth
- NodeManagedServices
- NodePowerLastOperation
- NodePowerOperation
- NodePowerOperationError
- NodePowerOperationQueued
- NodePowerState
- NodeState
- ObservatoryV1AuditCoverage
- ObservatoryV1AuditCoverageGap
- ObservatoryV1AuditCoverageVerdict
- ObservatoryV1AuditOrder
- ObservatoryV1AuditQueryError
- ObservatoryV1AuditQueryState
- ObservatoryV1AuditQueryStatistics
- ObservatoryV1CancelAuditQueryResponse
- ObservatoryV1CreateAuditQueryResponse
- ObservatoryV1GetAuditCoverageResponse
- ObservatoryV1GetAuditQueryResponse
- ObservatoryV1GetAuditQueryResultsResponse
- ObservatoryV1LogsQueryResponse
- ObservatoryV1MetricsResult
- ObservatoryV1QueryRangeResponse
- ObservatoryV1QueryResponse
- ObservatoryV1ResolveClustersResponse
- ObservatoryV1ResolvedCluster
- OsConfig
- PowerActionReadiness
- PublicKeyEntry
- QueryRangeRequest
- QueryRequest
- RemoveFleetSSHKeyResponse
- SSHKey
- SlurmParameters
- SlurmParametersSshKeysInner
- StorageConfig
- StorageProtectionPolicy
- StorageView
- StorageViewListResponse
- UpdateStorageViewRequest
Authentication schemes defined for the API:
- Type: Bearer authentication (JWT)
MetricsApi, LogsApi, KubernetesAuditApi and ClustersApi query your organization's
telemetry with the same client ID and secret. The SDK requests the access token
these APIs need for you; your application needs metrics or logs read access
(contact Voltage Park support to enable it).
import datetime
import vpcloud_client
from vpcloud_client.models.query_range_request import QueryRangeRequest
from vpcloud_client.results import decode_result
end = datetime.datetime.now(datetime.timezone.utc)
configuration = vpcloud_client.Configuration() # reads VPCLOUD_CLIENT_ID / VPCLOUD_CLIENT_SECRET; no region needed
with vpcloud_client.ApiClient(configuration) as api_client:
metrics = vpcloud_client.MetricsApi(api_client)
# Across your whole organization; query_metrics_range(cluster_id, ...) for one cluster.
response = metrics.query_org_metrics_range(QueryRangeRequest(
query="sum by (__name__) ({__name__=~\".*_iops.*\"})",
start=end - datetime.timedelta(hours=1),
end=end,
step="60s",
))
for series in decode_result(response).series():
print(series.labels, [(sample.time, sample.value) for sample in series.samples])- Queries are PromQL (metrics) and LogsQL (logs), sent as written. Results are
in Prometheus format;
vpcloud_client.results.decode_resultturns them into series and samples, anddecode_json_linesdecodes log lines and audit events. step, here and inwatch, accepts"60s", a Prometheus duration such as"5m"or"1h30m", seconds, or adatetime.timedelta.ClustersApi.resolve_clusters()lists your clusters and the regional endpoint that serves each one. For a cluster in another region, pass thatregion=, or setConfiguration(observatory_host=<that endpoint>).
vpcloud_client.streaming follows metrics and logs live. watch re-evaluates
PromQL queries every step and yields each result as it arrives; tail yields
log lines as they are written. Both take the same Configuration or
ApiClient, and awatch / atail are the asyncio versions.
import vpcloud_client
from vpcloud_client.streaming import tail, watch
configuration = vpcloud_client.Configuration()
# Across your whole organization; pass cluster_id=... for one cluster.
with watch(configuration, 'sum by (__name__) ({__name__=~".*_iops.*"})', step="15s", reconnect=True) as stream:
for event in stream:
for series in event.series():
print(event.name, series.labels, [(s.time, s.value) for s in series.samples])
with tail(configuration, "error", cluster_id="<cluster id>", reconnect=True) as stream:
for event in stream:
print(event.line["_time"], event.line["_msg"])queriesis one query, a list (namedq0,q1, ...) or a mapping of name to query.mode="changes"yields only the series that appear or disappear (event.appeared,event.disappeared) instead of every sample.- Each event carries a
cursor. Withreconnect=Truea dropped stream reconnects from the last cursor; passcursor=to resume a stream you stopped yourself. - Errors raise
vpcloud_client.streaming.ConnectError, withcodeandmessage(for examplepermission_deniedfor a cluster outside your organization). Leaving thewithblock, or breaking out of the loop, closes the stream.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
The generated SDK includes third-party dependencies. For a complete list of dependencies and their licenses, see THIRD_PARTY_LICENSES.txt. All dependencies are compatible with the Apache License 2.0.