Skip to main content

VASTPY

A Python SDK for interacting with the VAST Management System (VMS) REST API. This package provides a simple and intuitive interface to manage your VAST storage system programmatically.

Features

  • Full REST API coverage with a Pythonic interface
  • Command-line interface (CLI) for quick operations
  • Support for all HTTP methods (GET, POST, PATCH, DELETE)
  • JSON file input support for complex operations
  • Schema-less design compatible with all VAST versions

Installation

pip install vastpy

The package is available on PyPI: https://pypi.org/project/vastpy/

Requirements

  • Python 3.6 or higher
  • urllib3 1.2 or higher

Quick Start

Python SDK

Authentication

from vastpy import VASTClient

# Initialize with credentials
client = VASTClient(
    user='your_username',
    password='your_password',
    address='vast-vms-hostname'
)

View Management

# List all views
for view in client.views.get():
    print(view)

# Create a new view with the default policy
policies = client.viewpolicies.get(name='default')
default_policy = policies[0]  # Get the first (and should be only) matching policy

# Create a new view using the default policy
view = client.views.post(
    path='/prod/pgsql',
    policy_id=default_policy['id'],  # Use the policy's unique identifier
    create_dir=True
)

# Update a view's protocols
view_to_update = client.views.get(path='/prod/pgsql')[0]  # Get the first matching view
updated_view = client.views[view_to_update['id']].patch(protocols=['NFS', 'SMB'])

# Delete a view
client.views[view['id']].delete()

Snapshot Management

# List snapshots with specific fields
snapshots = client.snapshots.get(fields=['id', 'path'])
for snapshot in snapshots:
    print(f"ID: {snapshot['id']}, Path: {snapshot['path']}")

# Create a new snapshot
snapshot = client.snapshots.post(path='/prod/pgsql', name='db')

Monitoring

# Query protocol metrics
metrics = client.monitors.ad_hoc_query.get(
    object_type='cluster',
    time_frame='5m',
    prop_list=[
        'ProtoMetrics,proto_name=ProtoCommon,iops',  # Aggregated IOPS across protocols
        'ProtoMetrics,proto_name=ProtoCommon,bw',    # Aggregated bandwidth
        'ProtoMetrics,proto_name=NFS,iops',          # NFS-specific IOPS
        'ProtoMetrics,proto_name=SMB,bw',            # SMB-specific bandwidth
        'ProtoMetrics,proto_name=S3,latency'         # S3 protocol latency
    ]
)

Command Line Interface

The package also includes a CLI tool (vastpy-cli) for quick operations.

Authentication

Credentials can be provided through environment variables or command-line arguments:

# Using environment variables
$ export VMS_USER=admin
$ export VMS_PASSWORD=your_password
$ export VMS_ADDRESS=vast-vms-hostname

# Or using command-line arguments
$ vastpy-cli --user=admin --password=your_password --address=vast-vms-hostname

Basic Operations

Any method (get, post, patch, delete) is supported:

# List snapshots
$ vastpy-cli get snapshots fields=id,path
[
  {
    "path": "/dbs",
    "id": 12
  },
  {
    "path": "/datasets",
    "id": 43
  },
...
]

# Create a new view
$ vastpy-cli post views path=/prod/pgsql create_dir=true policy_id=1
{
  "id": 109,
  "guid": "551b5fc0-42a2-4b77-b385-d5bf6a6c1538",
  "name": "view-109",
  "title": "/prod/pgsql",
...

# Create a new snapshot
$ vastpy-cli post snapshots path=/prod/pgsql name=db
{
  "id": 4707792,
  "name": "db_snapshot",
  "path": "/prod/pgsql"
...

# Delete a view
$ vastpy-cli delete views/109

Complex Operations

For complex operations, you can use JSON input files:

# Create a file with your configuration
$ cat > config.json << EOF
{
  "read_access_users": ["vastadmin"],
  "read_access_users_groups": ["vastadmin"],
  "protocols_audit": {
    "log_full_path": true,
    "modify_data_md": true,
    "create_delete_files_dirs_objects": true
  },
  "enable_vast_db_audit": true
}
EOF

# Apply the configuration
vastpy-cli patch clusters/<cluster_id>/auditing --file-input config.json

API Documentation

While developing applications using the VMS API, please refer to the documentation available on your VAST system:

https://vast-vms-hostname/docs

Version Compatibility

This SDK is designed to be schema-less, making it compatible with all VAST versions. The Python objects are translated directly to REST API endpoints:

  • client.collection[object].get()GET /api/collection/object
  • client.collection.post()POST /api/collection
  • client.collection[object].patch()PATCH /api/collection/object
  • client.collection[object].delete()DELETE /api/collection/object

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vastpy-0.3.10.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vastpy-0.3.10-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file vastpy-0.3.10.tar.gz.

File metadata

  • Download URL: vastpy-0.3.10.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.9 Darwin/23.6.0

File hashes

Hashes for vastpy-0.3.10.tar.gz
Algorithm Hash digest
SHA256 3411aa46bcacdbf31c77ac4f4bda92f4ca71327b98fed29292f65efda6eda1b1
MD5 3c5918e71c7635ff68c07a35fd5d895d
BLAKE2b-256 35dcab6a0a62508cd6f2247a091f7660167760a6b3f4e942b90f00e569ae5cb8

See more details on using hashes here.

File details

Details for the file vastpy-0.3.10-py3-none-any.whl.

File metadata

  • Download URL: vastpy-0.3.10-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.9 Darwin/23.6.0

File hashes

Hashes for vastpy-0.3.10-py3-none-any.whl
Algorithm Hash digest
SHA256 00184ed39d864d12f01a25ea3e303674d77c22177ac66f2e6c4081f22ce461f6
MD5 d613217a7d7f01caec98274861db43c8
BLAKE2b-256 3ce8e49ed132bfc8ac9f78e8def87aad136b1f7992c07cf5f0f422c761f08f86

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.22

2 files

0.3.21

2 files

0.3.20

2 files

0.3.19

2 files

0.3.18

2 files

0.3.17

2 files

0.3.16

2 files

0.3.15

2 files

0.3.14

2 files

0.3.13

2 files

0.3.12

2 files

0.3.11

2 files

This release

0.3.10 This release

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page