No project description provided
Project description
VASTPY
This package is a Python SDK to the VMS (VAST Management System) REST API.
While developing against the VMS API use the documentation locally available at https://vms-host-name/docs.
Install
pip install vastpy
The package is hosted in PyPI: https://pypi.org/project/vastpy/
SDK Usage
Initialization:
from vastpy import VASTClient
client = VASTClient(user='user', password='********', address='vast-vms')
The API is straightforward:
client.<collection>.get()
client.<collection>.post()
client.<collection>[<object>].get()
client.<collection>[<object>].patch()
client.<collection>[<object>].delete()
Accessing collections:
for view in client.views.get():
print(view)
Creating objects:
policy, = client.viewpolicies.get(name='default')
view = client.views.post(path='/prod/pgsql', policy_id=policy['id'], create_dir=True)
Modifying/deleting objects:
view, = client.views.get(path='/prod/pgsql')
view = client.views[view['id']].patch(protocols=['NFS', 'SMB'])
client.views[view['id']].delete()
Reading metrics:
client.monitors.ad_hoc_query.get(object_type='cluster',
time_frame='5m',
prop_list=['ProtoMetrics,proto_name=ProtoCommon,iops',
'ProtoMetrics,proto_name=ProtoCommon,bw'])
CLI Usage
Credentials can be passed through environment variables or parameters:
$ export VMS_USER=admin VMS_PASSWORD=******** VMS_ADDRESS=vast-file-server
$ vastpy-cli get snapshots fields=id,path
[
{
"path": "/dbs",
"id": 12
},
{
"path": "/datasets",
"id": 43
},
...
$ vastpy-cli --user=admin --password==******** --address=vast-file-server get snapshots fields=id,path
Any method (get, post, patch, delete) is supported:
$ vastpy-cli post snapshots path=/projects/db name=db
{
"id": 4707792,
"name": "db_snapshot",
"path": "/projects/db"
...
$ vastpy-cli post views path=/projects/db create_dir=true policy_id=1
{
"id": 109,
"guid": "551b5fc0-42a2-4b77-b385-d5bf6a6c1538",
"name": "view-109",
"title": "/projects/db",
...
$ vastpy-cli delete views/109
Version Compatibility
This package is compatible with any VAST version as it's schema-less.
Python objects are simply translated to URLs: client.collection[object].get()
is translated to GET /api/collection/object
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file vastpy-0.3.2.tar.gz
.
File metadata
- Download URL: vastpy-0.3.2.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.9 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76f73920413c87903e0c48df7c75d596196b4c813828db24b4ba4ab515cf2a4a |
|
MD5 | e8e127b30eb081fee8141f4d0dd1e5e0 |
|
BLAKE2b-256 | b1152df2aa20658a863f2be57939b1a898e89b1500eefb98235b40df72405cac |
File details
Details for the file vastpy-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: vastpy-0.3.2-py3-none-any.whl
- Upload date:
- Size: 8.9 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cfc90db4bb3c3cf5f9431eaa1ec3b0a690b8ec967d906b89a4a0ab73a63c4b9 |
|
MD5 | d682166c6333caf28d973d0d69b0196b |
|
BLAKE2b-256 | da3fe3f14bd76f99491219ca5c0f60243d06fcb7eb8381291ee0ca75170b0338 |