Skip to content

About

Public Python SDK for Voltage Park Cloud

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

VP Cloud SDK

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: 2.1.0
  • Generator version: 7.16.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.9+

Installation & Usage

uv (Recommended)

Clone the repository and:

git clone https://github.com/voltagepark/vp-cloud-sdk.git
cd vp-cloud-sdk
uv sync
source .venv/bin/activate

Then import the package:

import vpcloud_client

Tests

Execute pytest to run the tests.

Configuration

Before using the SDK, you need to export the following environment variables:

export VPCLOUD_CLIENT_ID=
export VPCLOUD_CLIENT_SECRET=

Getting Started

Please follow the installation procedure and then run the following:

import os
import json
import vpcloud_client
from vpcloud_client.rest import ApiException

# Configure Auth0 M2M authentication using client credentials
# The SDK will automatically exchange these for an access token
# Defining the host is optional and defaults to https://api.sea1.voltagepark.com
# See configuration.py for a list of all supported configuration parameters.
configuration = vpcloud_client.Configuration(
    host = "https://api.sea1.voltagepark.com",
    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(), 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.py

Documentation for API Endpoints

All URIs are relative to https://api.sea1.voltagepark.com

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

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: Bearer authentication (JWT)

Author

Metrics, logs and audit

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

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_result turns them into series and samples, and decode_json_lines decodes log lines and audit events.
  • ClustersApi.resolve_clusters() lists your clusters and the regional endpoint that serves each one. For a cluster served elsewhere, set Configuration(observatory_host=<that endpoint>).

Streaming

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"])
  • queries is one query, a list (named q0, 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. With reconnect=True a dropped stream reconnects from the last cursor; pass cursor= to resume a stream you stopped yourself.
  • Errors raise vpcloud_client.streaming.ConnectError, with code and message (for example permission_denied for a cluster outside your organization). Leaving the with block, or breaking out of the loop, closes the stream.

License

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.

About

Public Python SDK for Voltage Park Cloud

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages