Programming libraries wrapping the EIS Virtual Cloud RESTful API
Python client for the EIS Virtual Cloud RESTful API
The python client allows you to interact with the API using its self-descriptive methods, for instance creating a virtual machine is as easy as calling the create_vm method as follows:
from pyvss.manager import VssManager vss = VssManager(tk='api_token') # get vms vms = vss.get_vms() # create vm req = vss.create_vm(os='ubuntu64Guest', built='os_install', description='Testing python wrapper', folder='group-v6736', bill_dept='EIS', disks=[100, 100]) uuid = vss.wait_for_request(req['_links']['request'], 'vm_uuid', 'Processed')
By setting the VSS_API_TOKEN environment variable and then executing the manager.py script and using as input args the function name followed by any parameters, the response is displayed to stdout.
python pyvss/manager.py get_vms 'summary=1&name=pm' [{u'_links': {u'self': u'https://vss-api.eis.utoronto.ca:8001/v2/vm/<vm_uuid>'}, u'cpuCount': 2, u'folder': {u'_links': {u'self': u'https://vss-api.eis.utoronto.ca:8001/v2/folder/group-v519'}, u'moref': u'group-v519', u'name': u'Public', u'parent': u'API'}, u'guestFullName': u'Ubuntu Linux (64-bit)', u'ipAddress': u'<ip_addr>', u'memoryMB': 4096, u'name': u'1502P-pm', u'overallStatus': u'green', u'powerState': u'poweredOn', u'storageB': 96637166467, u'uuid': u'<vm_uuid>'}]
How to install
Installing the library is quite simple. Either clone the GitLab repository or download the source code or use pip to do everything for you:
# pip virtualenv ~/VirtualEnvs/pyvss . ~/VirtualEnvs/pyvss/activate pip install pyvss # git git clone git@gitlab.eis.utoronto.ca:vss/py-vss.git cd py-vss python setup.py install