VAST Data SDK

2.0.14 · active · verified Sun Apr 12

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

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the `VASTClient` using environment variables for credentials and endpoint, and then fetches basic system information. It's crucial to set `VAST_ENDPOINT`, `VAST_USERNAME`, and `VAST_PASSWORD` before running.

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

view raw JSON →