VAST Data SDK
The `vastdb` library is the official Python SDK for interacting with VAST Data Universal Storage systems. It provides programmatic access to manage and monitor VAST clusters, tenants, and other system resources. It is actively maintained with frequent releases, currently at version 2.0.14.
Warnings
- breaking Version 2.0.0 introduced breaking changes, particularly for existing API endpoint interactions. This may require updating how certain methods are called or how data models are structured.
- gotcha The SDK requires Python 3.10 or newer. Users on older Python versions will encounter installation or runtime errors.
- gotcha The `endpoint` parameter for `VASTClient` must be a complete URL, including the `https://` scheme and the correct path to the VAST API endpoint (e.g., `https://my-vast-cluster.example.com`). Omitting the scheme or providing an incorrect path will result in connection errors.
- gotcha Disabling SSL verification (`verify_ssl=False`) should only be done in development or controlled test environments where self-signed certificates are used. In production, always ensure `verify_ssl=True` (the default) to prevent man-in-the-middle attacks.
Install
-
pip install vastdb
Imports
- VASTClient
from vastdb import VASTClient
- VastdbError
from vastdb.errors import VastdbError
Quickstart
import os
from vastdb import VASTClient
from vastdb.errors import VastdbError
# Ensure these environment variables are set:
# VAST_ENDPOINT="https://your-vast-cluster.example.com"
# VAST_USERNAME="your-username"
# VAST_PASSWORD="your-password"
# VAST_VERIFY_SSL="false" (optional, for self-signed or test certs)
endpoint = os.environ.get("VAST_ENDPOINT", "")
username = os.environ.get("VAST_USERNAME", "")
password = os.environ.get("VAST_PASSWORD", "")
verify_ssl = os.environ.get("VAST_VERIFY_SSL", "true").lower() == "true"
if not all([endpoint, username, password]):
print("Error: VAST_ENDPOINT, VAST_USERNAME, and VAST_PASSWORD environment variables must be set.")
print("Please configure your environment or .env file.")
else:
try:
client = VASTClient(
endpoint=endpoint,
username=username,
password=password,
verify_ssl=verify_ssl
)
print("Successfully initialized VASTClient.")
# Example: Get system information
system_info = client.get_system_info()
print(f"Connected to VAST Data system (UUID: {system_info.uuid}, Version: {system_info.version}).")
except VastdbError as e:
print(f"VAST Data SDK Error: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")