pyvss

Manager

This module simply sends request to the EIS RESTful API, and returns their response as a dict.

class pyvss.manager.VssManager(tk=None)[source]

Bases: object

ack_vm_alarm(uuid, moref, **kwargs)[source]

Acknowledges given Virtual Machine alarm

Parameters:
  • uuid (str) – Virtual Machine uuid
  • moref – Virtual Machine Alarm managed object reference
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

cancel_scheduled_change_request(request_id)[source]

Cancels scheduled execution of a given change request

Parameters:request_id (int) – Change request id
Returns:request status
clear_vm_alarm(uuid, moref, **kwargs)[source]

Clears given Virtual Machine alarm

Parameters:
  • uuid (str) – Virtual Machine uuid
  • moref – Virtual Machine Alarm managed object reference
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

consolidate_vm_disks(uuid, **kwargs)[source]

Submits a Virtual Machine disk consolidation

Parameters:uuid
Returns:change request object

Note

keyword arguments include schedule to process request on a given date and time

content_type = 'application/json'

Class containing methods to interact with the VSS REST API

Example:

vss = VssManager(tk='access-token')
vss.whoami()

If tk is none it will get the token from the VSS_API_TOKEN environment variable.

Example:

vss = VssManager()
vss.whoami()
create_folder(moref, name)[source]

Creates logical folder under given managed object reference

Parameters:
  • moref – Parent folder managed object reference
  • name – New folder name
Returns:

folder request object

create_inventory_file(props=None, fmt='json')[source]

Submits a request to generate a full inventory report of your Virtual Machines.

The report will be transferred to your space at VSKEY-STOR and also be available via download_inventory_result()

Parameters:
  • props (list) – properties to include in report
  • fmt (str) – report format <json|csv>. default json
Returns:

inventory request object

Note

See Inventory Docs for more information

create_vm(os, built, bill_dept, description, folder, networks, disks, name=None, iso=None, notes=None, usage='Test', cpu=1, memoryGB=1, high_io=False, **kwargs)[source]

Creates single Virtual Machine. Names are generated by appending name_number

Parameters:
  • os (str) – Operating system id.
  • built – built process
  • bill_dept (str) – Billing department
  • description (str) – VM description
  • folder (str) – Target VM folder moref
  • networks (list) – list of networks moref
  • disks (list) – list of disk sizes in GB
  • name (str) – name of the new virtual machine
  • iso (str) – ISO image path to be mounted after creation
  • notes (dict) – Custom Notes in key value format to store in the Virtual Machine annotation as meta-data.
  • usage (str) – virtual machine usage
  • cpu (int) – vCPU count
  • memoryGB (int) – Memory size in GB
  • high_io (bool) – If set to true,VM will be created with a VMware Paravirtual SCSIController.
Returns:

new request objects

See also

get_os() for os parameter, get_images() for image, get_folder() for folder, get_networks() for networks, get_isos() for isos

Note

more information about required attributes available in Virtual Machine

create_vm_custom_spec(uuid, custom_spec, **kwargs)[source]

Create a custom specification for a given virtual machine.

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • custom_spec (dict) – OS customization specification. Required if the resulting virtual machine needs to be reconfigure upon first boot. The current version of VMware Tools must be installed on the virtual machine or template to customize the guest operating system during cloning or deployment.
  • kwargs
Returns:

Note

Virtual machine must be powered on and VMware Tools must be installed.

See also

get_custom_spec() for customization specification.

create_vm_disk(uuid, disk, valueGB, **kwargs)[source]

Create new virtual disk with a given capacity

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • disk (int) – unit to create
  • valueGB (int) – capacity in GB
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

create_vm_from_clone(source_vm, description, name=None, os=None, bill_dept=None, folder=None, networks=None, disks=None, notes=None, usage=None, cpu=None, memoryGB=None, high_io=None, custom_spec=None, **kwargs)[source]

Deploy virtual machine by cloning from any given source

Parameters:
  • source_vm (str) – Source virtual machine uuid
  • description (str) – Brief description of what the virtual machine will host
  • name (str) – Virtual machine name. If not specified, will create a new name based on source
  • os (str) – Operating system id. If not specified, will be same as source.
  • bill_dept (str) – Billing department. If not specified, will be same as source.
  • folder (str) – Target folder moref. This is the logical folder storing the new virtual machine. If not specified, will be same as source.
  • networks (list) – list of networks moref. Network adapters are created based on the network index, then first item in the list is mapped to network adapter 1. If not specified, will be same as source.
  • disks – list of disk sizes in GB. Same as networks, each disk item is mapped to a hard disk drive of a given size. If not specified, will be same as source. :type disks: list
  • notes (dict) – Custom Notes in key value format to store in the Virtual Machine annotation as meta-data.
  • usage (str) – virtual machine usage. If not specified, will be same as source.
  • cpu (int) – vCPU count. If not specified, will be same as source.
  • memoryGB (int) – Memory size in GB. If not specified, will be same as source.
  • high_io (bool) – If set to true,VM will be created with a VMware Paravirtual SCSIController. If not specified, will be same as source.
  • custom_spec (dict) – OS customization specification. Required if the resulting virtual machine needs to be reconfigure upon first boot. The current version of VMware Tools must be installed on the virtual machine or template to customize the guest operating system during cloning or deployment.
  • kwargs
Returns:

new request object

See also

get_os() for os parameter, get_images() for image, get_folder() for folder, get_networks() for networks, get_custom_spec() for customization specification.

Note

more information about required attributes available in Virtual Machine

create_vm_from_image(os, image, bill_dept, description, folder, networks, disks, notes=None, usage='Test', name=None, cpu=1, memoryGB=1, high_io=False, **kwargs)[source]

Creates a new Virtual Machine from OVA or OVF

Parameters:
  • os (str) – Operating system id.
  • image (str) – OVA/OVF filename
  • bill_dept (str) – Billing department
  • description (str) – Brief description of what the virtual machine will host.
  • folder (str) – Target folder moref. This is the logical folder storing the new virtual machine.
  • networks (list) – list of networks moref. Network adapters are created based on the network index, then first item in the list is mapped to network adapter 1.
  • disks (list) – list of disk sizes in GB. Same as networks, each disk item is mapped to a hard disk drive of a given size.
  • notes (dict) – Custom Notes in key value format to store in the Virtual Machine annotation as meta-data.
  • usage (str) – virtual machine usage. Defaults to Test
  • name (str) – Virtual Machine name. If not set, will be generated dynamically by the API
  • cpu (int) – vCPU count. Defaults to 1vCPU
  • memoryGB (int) – Memory size in GB. Defaults to 1GB
  • high_io (bool) – If set to true,VM will be created with a VMware Paravirtual SCSIController. Defaults to False.
Returns:

new request object

See also

get_os() for os parameter, get_images() for image, get_folder() for folder, get_networks() for networks.

Note

more information about required attributes available in Virtual Machine

create_vm_nic(uuid, nic, network, **kwargs)[source]

Creates Virtual Machine NIC

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • nic (int) – Network interface card number
  • network (str) – Network moref to attach
Returns:

change request object

create_vm_snapshot(uuid, desc, date_time, valid)[source]

Creates a Virtual Machine snapshot on a given date and time

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • desc (str) – A brief description of the snapshot.
  • date_time – Timestamp with the following format %Y-%m-%d %H:%M. If date is in the past, the change request will be processed right away, otherwise it will wait.
  • valid (int) – Number of hours (max 72) the snapshot will live
Returns:

snapshot request object

create_vms(count, name, os, built, bill_dept, description, folder, networks, disks, iso=None, notes=None, usage='Test', cpu=1, memoryGB=1, high_io=False, **kwargs)[source]

Creates multiple Virtual Machines. Names are generated by appending name_number

Parameters:
  • count (int) – number of virtual machines to deploy
  • name (str) – name of the new virtual machines
  • os (str) – Operating system id.
  • built – built process
  • bill_dept (str) – Billing department
  • description (str) – Brief description of what the virtual machine will host.
  • folder (str) – Target folder moref. This is the logical folder storing the new virtual machine.
  • networks (list) – list of networks moref. Network adapters are created based on the network index, then first item in the list is mapped to network adapter 1.
  • disks (list) – list of disk sizes in GB. Same as networks, each disk item is mapped to a hard disk drive of a given size.
  • iso (str) – ISO image path to be mounted after creation
  • notes (dict) – Custom Notes in key value format to store in the Virtual Machine annotation as meta-data.
  • usage (str) – virtual machine usage
  • cpu (int) – vCPU count. Defaults to 1vCPU
  • memoryGB (int) – Memory size in GB. Defaults to 1GB
  • high_io (bool) – If set to true,VM will be created with a VMware Paravirtual SCSIController. Defaults to False.
Returns:

new request objects

See also

get_os() for os parameter, get_images() for image, get_folder() for folder, get_networks() for networks, get_isos() for isos

Note

more information about required attributes available in Virtual Machine

delete_user_token(token_id)[source]

Deletes given token id

Parameters:token_id (int) – Token id to delete
Returns:dict with request status
delete_vm(uuid, force=False)[source]

Deletes given Virtual Machine

Parameters:
  • uuid (str) – Virtual Machine uuid
  • force (bool) – Force deletion if vm is on
Returns:

change request object

delete_vm_disk(uuid, disk, **kwargs)[source]

Deletes given Virtual Machine disk capacity

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • disk (int) – unit to delete
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

delete_vm_nic(uuid, nic, **kwargs)[source]

Deletes Virtual Machine NIC unit

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • nic (int) – Network interface card number
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

delete_vm_snapshot(uuid, snapshot)[source]

Deletes given Virtual Machine snapshot

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • snapshot (int) – Snapshot Id
Returns:

snapshot request object

deploy_vm_from_template(source_template, description, name=None, os=None, bill_dept=None, folder=None, networks=None, disks=None, notes=None, usage=None, cpu=None, memoryGB=None, high_io=None, custom_spec=None, **kwargs)[source]

Deploy single virtual machine from template.

Recommended approach for multiple virtual machine deployment from template with independent specification, including custom_spec configuration.

Parameters:
  • source_template – Source virtual machine template
  • description (str) – Brief description of what the virtual machine will host
  • name (str) – Virtual machine name. If not specified, will create new virtual machine based on source template name appending the -clone suffix.
  • os (str) – Operating system id. If not specified, will be same as source.
  • bill_dept (str) – Billing department. If not specified, will be same as source.
  • folder (str) – Target folder moref. This is the logical folder storing the new virtual machine. If not specified, will be same as source.
  • networks (list) – list of networks moref. Network adapters are created based on the network index, then first item in the list is mapped to network adapter 1. If not specified, will be same as source.
  • disks – list of disk sizes in GB. Same as networks, each disk item is mapped to a hard disk drive of a given size. If not specified, will be same as source. :type disks: list
  • notes (dict) – Custom Notes in key value format to store in the Virtual Machine annotation as meta-data.
  • usage (str) – virtual machine usage. If not specified, will be same as source.
  • cpu (int) – vCPU count. If not specified, will be same as source.
  • memoryGB (int) – Memory size in GB. If not specified, will be same as source.
  • high_io (bool) – If set to true,VM will be created with a VMware Paravirtual SCSIController. If not specified, will be same as source.
  • custom_spec (dict) – OS customization specification. Required if the resulting virtual machine needs to be reconfigure upon first boot. The current version of VMware Tools must be installed on the virtual machine or template to customize the guest operating system during cloning or deployment.
  • kwargs
Returns:

new request object

See also

get_templates() for virtual machine templates get_os() for os parameter, get_images() for image, get_folder() for folder, get_networks() for networks, get_custom_spec() for customization specification.

Note

more information about required attributes available in Virtual Machine

deploy_vms_from_template(source_template, description, count=1, name=None, os=None, bill_dept=None, folder=None, networks=None, disks=None, notes=None, usage=None, cpu=None, memoryGB=None, high_io=None, custom_spec=None, **kwargs)[source]

Deploy multiple or a single virtual machine from template.

Useful when you need to deploy multiple virtual machine instances from a single source. Not recommended when using custom_spec for guest OS customization specification.

Use deploy_vm_from_template() in a loop for deploying multiple virtual machines with different custom_spec.

Parameters:
  • source_template – Source virtual machine template
  • description (str) – Brief description of what the virtual machine will host
  • count – Number or virtual machines to deploy. Defaults to 1.
  • name (str) – Virtual machine name. If not specified, will create all new virtual machines based on source template name appending the number of item.
  • os (str) – Operating system id. If not specified, will be same as source.
  • bill_dept (str) – Billing department. If not specified, will be same as source.
  • folder (str) – Target folder moref. This is the logical folder storing the new virtual machine. If not specified, will be same as source.
  • networks (list) – list of networks moref. Network adapters are created based on the network index, then first item in the list is mapped to network adapter 1. If not specified, will be same as source.
  • disks – list of disk sizes in GB. Same as networks, each disk item is mapped to a hard disk drive of a given size. If not specified, will be same as source. :type disks: list
  • notes (dict) – Custom Notes in key value format to store in the Virtual Machine annotation as meta-data.
  • usage (str) – virtual machine usage. If not specified, will be same as source.
  • cpu (int) – vCPU count. If not specified, will be same as source.
  • memoryGB (int) – Memory size in GB. If not specified, will be same as source.
  • high_io (bool) – If set to true,VM will be created with a VMware Paravirtual SCSIController. If not specified, will be same as source.
  • custom_spec (dict) – OS customization specification. Required if the resulting virtual machine needs to be reconfigure upon first boot. The current version of VMware Tools must be installed on the virtual machine or template to customize the guest operating system during cloning or deployment.
  • kwargs
Returns:

new request object

See also

get_templates() for virtual machine templates get_os() for os parameter, get_images() for image, get_folder() for folder, get_networks() for networks, get_custom_spec() for customization specification.

Note

more information about required attributes available in Virtual Machine

disable_user_email()[source]

Disables all email notification

Returns:updated email settings object
disable_user_token(token_id)[source]

Disables given access token id

Parameters:token_id (int) – token id to disable
Returns:status dict
download_inventory_result(request_id, directory=None)[source]

Download given inventory report

Parameters:
  • request_id – Inventory request id
  • directory – Directory to download file
Returns:

full path to written file

Example:

vss.download_inventory_result(request_id=123,
                              directory='~/Downloads')

vss.download_inventory_result(request_id=123)

Note

See Inventory Docs for more information

enable_user_email()[source]

Enables all email notification

Returns:updated email settings object
enable_user_email_error()[source]

Updates email notification settings to get just errors

Returns:updated email settings object
export_vm(uuid)[source]

Export given Virtual Machine to OVF.

Parameters:uuid (str) – Virtual Machine uuid
Returns:export request object

Note

Once the export completes, will be transferred to VSKEY-STOR

extend_snapshot_request(request_id, duration)[source]

Extends valid snapshot request to a given number of hours

Parameters:
  • request_id (int) – Snapshot request id
  • duration (int) – new duration
Returns:

tuple with status and new snapshot data

get_change_request(request_id)[source]

Gets given change request data

Parameters:request_id (int) – change request id to get
Returns:object
get_change_requests(show_all=False, **kwargs)[source]

Gets change requests submitted for every change to a given virtual machine.

Parameters:show_all (bool) – Whether to show all requests or just the default count
Returns:list of objects

Note

keyword arguments implement filters such as paging, filtering and sorting. Refer to the official documentation for further details. See Request

Example:

vss.get_change_requests(filter='status,eq,Error Processed',
                        per_page=100)
static get_custom_spec(dhcp, hostname, domain, ip=None, subnet=None, dns=None, gateway=None)[source]

Generates a customization specification.

Parameters:
  • dhcp (bool) – Whether the virtual machine acquires IP config from DHCP. If set to true, parameters ip, subnet dns and gateway will be ignored.
  • hostname (str) – The network host name of the virtual machine.
  • domain (str) – A DNS domain suffix such as eis.utoronto.ca.
  • ip (str) – Specification to obtain a unique IP address for this virtual network adapter.
  • subnet (str) – Subnet mask for this virtual network adapter.
  • dns (list) – A list of server IP addresses to use for DNS lookup in a Windows guest operating system.
  • gateway (list) – For a virtual network adapter with a static IP address, this data object type contains a list of gateways, in order of preference.
Returns:

get_domain(moref, **kwargs)[source]

Get fault domain data

Parameters:
  • moref (str) – managed object reference
  • kwargs – filter keyword arguments
  • summary: list vms running on fault domain
Returns:object
get_domains(**kwargs)[source]

Get available Fault Domains

Parameters:kwargs – filters
  • moref: managed object reference
  • name: domain name
Returns:list of objects
get_export_request(request_id, **kwargs)[source]

Gets given export request data

Parameters:request_id (int) – export request id to get
Returns:object
get_export_requests(show_all=False, **kwargs)[source]

Gets virtual machine export requests

Parameters:show_all (bool) – Whether to show all requests or just the default count
Returns:list of objects

Note

keyword arguments implement filters such as paging, filtering and sorting. Refer to the official documentation for further details. See Request

Example:

vss.get_export_requests(filter='status,eq,Processed',
                        per_page=100)
get_floppies(**kwargs)[source]

Get list Floppy images you are allowed to access.

Also includes files in your VSKEY-STOR space with .flp extension.

Parameters:kwargs – filters
  • name: filter by name
  • path: filter by path
Returns:list of floppy images
get_folder(moref, **kwargs)[source]

Get logical folder data

Parameters:
  • moref (str) – managed object reference
  • kwargs – arguments to pass such as:
  • summary: enables children vm listing
Returns:object
get_folder_permission(moref)[source]

Gets Folder permission list

Parameters:moref (str) – Folder managed object reference
Returns:list of key value objects
get_folder_request(request_id, **kwargs)[source]

Gets given folder request data

Parameters:request_id (int) – folder request id to get
Returns:object
get_folder_requests(show_all=False, **kwargs)[source]

Gets folder requests

Parameters:show_all (bool) – Whether to show all requests or just the default count
Returns:list of objects

Note

keyword arguments implement filters such as paging, filtering and sorting. Refer to the official documentation for further details. See Request

Example:

vss.get_folder_requests(filter='status,eq,Processed',
                        per_page=100)
get_folders(**kwargs)[source]

Get list of logical folders

Parameters:kwargs – arguments to pass such as:
  • moref: filter by managed object reference
  • name: filter by name
  • parent: filter by parent name
  • summary: show folder summary
Returns:list of objects
get_images(**kwargs)[source]

Get available virtual machine OVF/OVA files.

Parameters:kwargs – filters
  • name: filter by name
  • path: filter by path
Returns:lust of images

Note

Files are stored in VSKEY-STOR

get_inventory_request(request_id, **kwargs)[source]

Gets given inventory request data

Parameters:request_id (int) – inventory request id to get
Returns:object
get_inventory_requests(show_all=False, **kwargs)[source]

Gets inventory requests

Parameters:show_all (bool) – Whether to show all requests or just the default count
Returns:list of objects

Note

keyword arguments implement filters such as paging, filtering and sorting. Refer to the official documentation for further details. See Request

Example:

vss.get_inventory_requests(filter='transferred,eq,true',
                           per_page=100)
get_isos(**kwargs)[source]

Get list ISO images you are allowed to access.

Also includes files in your VSKEY-STOR space.

Parameters:kwargs – filters
  • name: filter by name
  • path: filter by path
Returns:list of iso images
get_network(moref, **kwargs)[source]

Get details of given network

Parameters:
  • moref – network managed object reference
  • kwargs – additional parameters
  • summary: show vms on this network
Returns:list of virtual machine objects
get_network_permission(moref)[source]

Gets Network permission list

Parameters:moref (str) – Network managed object reference
Returns:list of key value objects
get_networks(**kwargs)[source]

Get list networks you are allowed to access

Parameters:kwargs – filters
  • name: filter by name
  • moref: filter by network managed object reference
  • summary: show network summary
Returns:list of objects
get_new_request(request_id)[source]

Gets given new request data

Parameters:request_id (int) – new request id to get
Returns:object
get_new_request_custom_spec(request_id)[source]

Gets given new request submitted custom specification.

Parameters:request_id (int) – new request id to get
Returns:object
get_new_request_meta_data(request_id)[source]

Gets given new request meta data

Parameters:request_id (int) – new request id to get
Returns:object
get_new_request_user_data(request_id, decode=False)[source]

Gets given new request submitted user data. Cloud-init user_data to preconfigure the guest os upon first boot.

Note

Experimental feature and currently tested with Ubuntu Cloud Images and VMware Photon OS. Only supported on OVA/OVF deployments.

Parameters:
  • request_id (int) – new request id to get
  • decode (bool) – whether to decode user_data
Returns:

object

get_new_requests(show_all=False, **kwargs)[source]

Gets new vm deployment requests.

Parameters:show_all (bool) – Whether to show all requests or just the default count
Returns:list of objects

Note

keyword arguments implement filters such as paging, filtering and sorting. Refer to the official documentation for further details. See Request

Example:

vss.get_new_requests(sort='created_on,desc', per_page=100)
get_os(name=False, show_all=True, **kwargs)[source]

Gets Virtual Machine supported Guest Operating systems

  • name: Guest operating system full name. i.e. CentOS 4/5
  • id: Guest operating system id. i.e. centosGuest
Parameters:
  • show_all (bool) – Whether to show all requests or just the default count
  • name – Filter by Guest OS full name
  • kwargs – arguments to pass such as: - guestId: Guest OS identifier - guestFullName: Guest OS full name.
Returns:

list of objects

Note

keyword arguments implement filters such as paging, filtering and sorting. Refer to the official documentation for further details. See Operating Systems

Example:

vss.get_os(sort='created_on,desc', per_page=100)
get_requests(**kwargs)[source]

Get Summary of current requests submitted

Returns:list of objects
get_snapshot_request(request_id, **kwargs)[source]

Gets given snapshot request data

Parameters:request_id (int) – snapshot request id to get
Returns:object
get_snapshot_requests(show_all=False, **kwargs)[source]

Gets snapshot requests

Parameters:show_all (bool) – Whether to show all requests or just the default count
Returns:list of objects

Note

keyword arguments implement filters such as paging, filtering and sorting. Refer to the official documentation for further details. See Request

Example:

vss.get_snapshot_request(filter='status,eq,Processed',
                        per_page=100)
get_templates(**kwargs)[source]

Get list of your templates

Parameters:kwargs – filters and flags
  • name: filters by name
  • summary: displays summary of template
Returns:list of virtual machine objects
get_token(user=None, password=None)[source]

Generates token based on two environment variables or provided OR and password:

  • VSS_API_USER: username
  • VSS_API_USER_PASS: password
Parameters:
  • user (str) – Username
  • password (str) – Username password
Returns:

generated token or VssError

get_user_email_settings()[source]

Returns current user email settings

Email settings currently are:

  • all: receive email notifications
  • completion: receive email notification upon completion
  • error: receive email notifications only when error
  • none: no email notifications
  • submission: receive email notification when submitted
Returns:object
get_user_group(cn, member=False)[source]

Gets user group info and members

Parameters:
  • cn (str) – group common name
  • member (bool) – whether to return member list
Returns:

list of str

get_user_groups()[source]

Gets current user groups

Returns:list of str
get_user_ldap()[source]

Gets LDAP related information about your account including

  • pwdAccountLockedTime: shows whether your LDAP account is locked
  • pwdChangeTime: time stamp when you changed your pwd
  • mail: associated emails
  • authTimestamp: last authenticated time stamp
Returns:object
get_user_personal()[source]

Returns your personal info, such as email, phone, username and full name.

Returns:object
get_user_roles()[source]

Gets both request and access roles of current user

Returns:object
get_user_status()[source]

Gets your current status including:

  • active: whether user is active or not
  • created_on: time stamp when user was created
  • last_access: most recent access time stamp
  • updated_on: last time user was updated
Returns:object
get_user_token(token_id)[source]

Obtains given token id data such as:

  • value
  • status
Parameters:token_id (int) – Access token id to manage
Returns:object
get_user_tokens(show_all=False, **kwargs)[source]

Gets user tokens

Parameters:show_all (bool) – Whether to show all tokens or just the default count
Returns:list of objects

Note

keyword arguments implement filters such as paging, filtering and sorting. Refer to the official documentation for further details. See User

Example:

vss.get_user_tokens(filter='active,eq,true',
                    per_page=10)
get_vm(uuid, **kwargs)[source]

Get basic information of given virtual machine

Parameters:uuid (str) – virtual machine uuid
Returns:object

Virtual Machine attributes include:

  • storage
  • state
  • snapshot
  • note
  • devices
  • memory
  • cpu
  • guest
  • folder

Note

more information about required attributes available in Virtual Machine

get_vm_alarm(uuid, moref)[source]

Get Virtual Machine Alarm

Parameters:
  • uuid (str) – Virtual Machine uuid
  • moref (str) – Alarm managed object reference
Returns:

list of objects

get_vm_alarms(uuid)[source]

Gets Virtual Machine Alarms

Parameters:uuid (str) – Virtual Machine uuid
Returns:list of objects
get_vm_boot(uuid)[source]

Queries given Virtual Machine boot configuration

Parameters:uuid (int) – Virtual Machine UUid
Returns:object

Configuration includes:

  • enterBIOSSetup
  • bootRetryDelayMs
  • bootDelayMs

Note

more information about required attributes available in Virtual Machine Attributes

get_vm_cd(uuid, cd)[source]

Returns Virtual Machine CD/DVD unit information such as:

  • backing
  • connected
  • controller
  • description
  • label
Parameters:
  • uuid (str) – Virtual Machine Uuid
  • cd (int) – CD/DVD unit number
Returns:

object

get_vm_cds(uuid)[source]

Returns Virtual Machine CD/DVD devices available.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of objects
get_vm_console(uuid)[source]

Produces a one-time URL to Virtual Machine console. Virtual machine needs to be powered on and user must have a valid vCenter session (limitation in the vSphere SOAP API).

Parameters:uuid (str) – Virtual Machine Uuid
Returns:object
get_vm_consolidation(uuid)[source]

Gets current Virtual Machine disks consolidation state

Parameters:uuid (str) – Virtual Machine Uuid
Returns:object
get_vm_cpu(uuid)[source]

Get VM cpu information such as:

  • coresPerSocket
  • cpu
  • hotAdd
  • hotRemove
  • quickStats
Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object
get_vm_disk(uuid, disk)[source]

Gets Virtual Machine disk data such as:

  • capacity
  • controller
  • description
  • label
  • shares
  • filenName
Parameters:
  • uuid (str) – Virtual Machine Uuid
  • disk (int) – Virtual Machine disk number
Returns:

object

get_vm_disks(uuid)[source]

Returns Virtual Machine available disks

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of objects
get_vm_domain(uuid)[source]

Get domain where Virtual Machine is running

Parameters:uuid (str) – Virtual Machine uuid
Returns:object
get_vm_events(uuid, hours=1)[source]

Queries Virtual Machine events in vCenter

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • hours (int) – Time window to get events from
Returns:

list of events

get_vm_extra_config(uuid)[source]

Gets custom VM extra configuration

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of key value objects
get_vm_floppies(uuid)[source]

Returns Virtual Machine Floppy devices available.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of objects
get_vm_floppy(uuid, floppy)[source]

Returns Virtual Machine floppy unit information such as:

  • backing
  • connected
  • controller
  • description
  • label
Parameters:
  • uuid (str) – Virtual Machine Uuid
  • floppy (int) – floppy unit number
Returns:

object

get_vm_folder(uuid)[source]

Gets given Virtual Machine parent folder information

Parameters:uuid (str) – Virtual Machine Uuid
Returns:object

attributes include:

  • full_path
  • name
  • parent
  • reference to folder resource

See also

get_folder() for further information about a given folder

get_vm_guest_ip(uuid)[source]

Get Virtual Machine IP and Mac addresses via VMware tools

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of objects
get_vm_guest_os(uuid)[source]

Gets Virtual Machine Guest Operating System

Parameters:uuid (str) – Virtual Machine Uuid
Returns:object
get_vm_guest_process_id(uuid, user, pwd, pid)[source]

Gets given process id info

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • user (str) – Guest Operating Username
  • pwd (str) – Guest Operating Username password
  • pid (int) – Process Id to query
Returns:

list of objects

Note

Processes running in the guest operating system can be listed using the API via VMware Tools. If VMware Tools has not been installed or is not running, this resource will not work properly.

Note

more information about required attributes available in Virtual Machine Attributes

get_vm_guest_processes(uuid, user, pwd)[source]

Gets given process id info

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • user (str) – Guest Operating Username
  • pwd (str) – Guest Operating Username password
Returns:

list of objects

Note

Processes running in the guest operating system can be listed using the API via VMware Tools. If VMware Tools has not been installed or is not running, this resource will not work properly.

Note

more information about required attributes available in Virtual Machine Attributes

get_vm_memory(uuid)[source]

Gets Virtual Machine memory information such as:

  • memoryGB
  • hotAdd
  • quickStats:
    • ballooned
    • compressed
    • consumedOverhead,
    • private
    • shared
    • swapped
Parameters:uuid (str) – Virtual Machine Uuid
Returns:object
get_vm_name(uuid)[source]

Gets given Virtual Machine full name

Parameters:uuid (str) – Virtual Machine uuid
Returns:object
get_vm_nic(uuid, nic)[source]

Gets Virtual Machine NIC information such as:

  • connected
  • label
  • macAddress
  • network
  • startConnected
  • type
Parameters:
  • uuid (str) – Virtual Machine Uuid
  • nic (int) – nic number
Returns:

get_vm_nics(uuid)[source]

Gets Virtual Machine NICs information.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of objects
get_vm_notes(uuid)[source]

Get Virtual Machine client notes. Metadata available for users to manage.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of key value notes
get_vm_os(uuid)[source]

Gets Virtual Machine configured Operating System

Parameters:uuid (str) – Virtual Machine Uuid
Returns:object
get_vm_performance_cpu(uuid)[source]

Queries given Virtual Machine CPU performance counters. VM has to be powered On.

Parameters:uuid (str) – Virtual Machine uuid
Returns:object

Performance counters include:

  • readyAvgPct
  • readyMaxPct
  • usagePct
get_vm_performance_io(uuid)[source]

Queries given Virtual Machine IO (datastore) performance counters. VM has to be powered On.

Parameters:uuid (str) – Virtual Machine uuid
Returns:object

Performance counters include:

  • ioReadIops
  • ioWriteIops
  • latReadMs
  • latWriteMs
get_vm_performance_memory(uuid)[source]

Queries given Virtual Machine Memory performance counters. VM has to be powered On.

Parameters:uuid (str) – Virtual Machine uuid
Returns:object

Performance counters include:

  • activeMb
  • activePct
  • balloonMb
  • balloonPct
  • dateTime
  • name
  • sharedMb
  • sharedPct
  • swappedMb
  • swappedPct
  • usagePct
get_vm_performance_net(uuid)[source]

Queries given Virtual Machine Network performance counters. VM has to be powered On.

Parameters:uuid (str) – Virtual Machine uuid
Returns:object

Performance counters include:

  • rxErrors
  • rxMbps
  • txErrors
  • txMbps
get_vm_permission(uuid)[source]

Gets VM permission list

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of key value objects
get_vm_snapshot(uuid, snapshot)[source]

Get given Virtual Machine Snapshot information

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • snapshot (int) – Snapshot Id
Returns:

object

get_vm_snapshots(uuid)[source]

Listing existent Virtual Machine snapshots

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of objects
get_vm_spec(uuid)[source]

Get given virtual Machine specification

Parameters:uuid (str) – virtual machine uuid
Returns:object

Note

useful to create a shell clone

get_vm_state(uuid)[source]

Gets given Virtual Machine state info

Parameters:uuid (str) – Virtual Machine uuid
Returns:object

Virtual Machine attributes include:

  • bootTime
  • domain
  • connectionState
  • powerState
get_vm_storage(uuid)[source]

Get Virtual Machine storage summary

Parameters:uuid (str) – Virtual Machine Uuid
Returns:dict with:
  • uncommittedGB
  • provisionedGB
  • committedGB
  • unsharedGB
get_vm_tools(uuid)[source]

Get VMware Tools status on given Virtual Machine

Parameters:uuid (str) – Virtual Machine Uuid
Returns:object

attributes include:

  • runningStatus
  • version
  • versionStatus
get_vm_version(uuid)[source]

Given Virtual Machine VMX version

Parameters:uuid (str) – Virtual Machine Uuid
Returns:object
get_vm_vss_admin(uuid)[source]

Get Virtual Machine administrator This is part of the VSS metadata added to the VM annotation.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:dict with phone, name and email of vm admin
get_vm_vss_changelog(uuid)[source]

Get Virtual Machine change log. Maximum change log entries are 9. This is part of the VSS metadata added to the VM annotation.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of changelog entries as dict
get_vm_vss_ha_group(uuid)[source]

Get Virtual Machine High Availability Group. This is part of the VSS metadata added to the VM annotation.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:object
get_vm_vss_inform(uuid)[source]

Get Virtual Machine informational contacts. This is part of the VSS metadata added to the VM annotation

Parameters:uuid (str) – Virtual Machine Uuid
Returns:list of email addresses if any
get_vm_vss_requested(uuid)[source]

Get Virtual Machine requested timestamp :param uuid: Virtual Machine Uuid :type uuid: str :return: timestamp in str or none if unknown

get_vm_vss_usage(uuid)[source]

Get Virtual Machine Usage. This is part of the VSS metadata added to the VM annotation.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:dict
get_vms(**kwargs)[source]

Get list of virtual machines

Parameters:kwargs – filters and flags
  • dns: filter by main dns name
  • ip: filter by main ip address
  • name: filter by name
  • path: filter by VM path
  • summary: show VMs summary or not.
Returns:list of virtual machine objects
get_vms_by_domain(domain_moref)[source]

Get Virtual Machines on given Fault Domain

Parameters:domain_moref (str) – Domain managed object reference
Returns:list of vm objects
get_vms_by_network(moref)[source]

Get Virtual Machines on given network

Parameters:moref – network managed object reference
Returns:list of objects
get_vskey_stor(**kwargs)[source]

Instantiates a WebDav Client to interact with VSKEY-STOR

Parameters:kwargs – keyword arguments with

Warning

WebdavClient module is required

Example:

# Creating an instance with username and password if
# no env var was set
vss.get_vskey_stor(webdav_login='user',
webdav_password='P455w00rD')

# Download inventory file
vss.vskey_stor.download_sync(
remote_path='inventory/584e7ada-efbf-4bf8-915c-c6ef02f70547.csv',
local_path='~/Downloads/584e7ada-efbf-4bf8-915c-c6ef02f70547.csv')

# Upload image
vss.vskey_stor.upload_sync(
remote_path='images/coreos_production_vmware_ova.ova',
local_path='~/Downloads/coreos_production_vmware_ova.ova')
has_vm_snapshot(uuid)[source]

Validates if Virtual Machine has snapshots

Parameters:uuid (str) – Virtual Machine Uuid
Returns:bool
is_powered_on_vm(uuid)[source]

Checks if given Virtual Machine is powered On.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:bool
is_vm_template(uuid)[source]

Checks if Virtual Machine is marked as template

Parameters:uuid (str) – Virtual Machine Uuid
Returns:bool
mark_template_as_vm(uuid, **kwargs)[source]

Marks Template as Virtual Machine.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

keyword arguments include schedule to process request on a given date and time

mark_vm_as_template(uuid, **kwargs)[source]

Marks Virtual Machine as template to freeze changes. Templates cannot be modified nor powered on unless marked as Virtual Machine.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

keyword arguments include schedule to process request on a given date and time

mount_vm_tools(uuid, **kwargs)[source]

Mounts VMware official distribution of VMware Tools in Guest Operating system

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

This method fails if Guest OS is running an unmanaged distribution of VMware Tools.

Note

keyword arguments include schedule to process request on a given date and time

move_folder(moref, new_moref)[source]

Moves given folder to new parent

Parameters:
  • moref – folder to move managed object reference
  • new_moref – target parent managed object reference to move folder to
Returns:

folder request object

power_off_vm(uuid, **kwargs)[source]

Power Off VM. This method powers Off given virtual machine.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

keyword arguments include schedule to process request on a given date and time

power_on_vm(uuid, **kwargs)[source]

Power On VM. This method powers on given virtual machine.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

keyword arguments include schedule to process request on a given date and time

static process_response(response)[source]

Processes response codes :param response: request.response object :return: dict

reboot_vm(uuid, **kwargs)[source]

Graceful reboot VM. This method sends a reboot signal via VMware Tools to the Guest Operating system, thus VMware Tools is required up-to-date and running on VM.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

keyword arguments include schedule to process request on a given date and time

rename_folder(moref, name, **kwargs)[source]

Renames given logical folder

Parameters:
  • moref – folder managed object reference
  • name – folder new name
Returns:

folder request object

rename_vm(uuid, name, **kwargs)[source]

Update Virtual Machine name. This do not change the VSS prefix YYMM{P|Q|D|T}-VMName.

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • name – New virtual machine name. Do not include VSS prefix.
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

request_v2(url, headers=None, params=None, payload=None, method='GET', auth=None, timeout=60)[source]
reschedule_change_request(request_id, date_time)[source]

Reschedules a given change request

Parameters:
  • request_id (int) – Change request id
  • date_time (str) – Timestamp with the following format %Y-%m-%d %H:%M. If date is in the past, the change request will be processed right away, otherwise it will wait.
Returns:

request status

reset_vm(uuid, **kwargs)[source]

Hard reset VM. This method resets a given Virtual Machine. This method is equivalent to power_off_vm and power_on_vm

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

keyword arguments include schedule to process request on a given date and time

revert_vm_snapshot(uuid, snapshot)[source]

Reverts to given Virtual Machine snapshot

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • snapshot (int) – Snapshot Id
Returns:

snapshot request object

run_cmd_guest_vm(uuid, user, pwd, cmd, arg, **kwargs)[source]

Executes command in Guest Operating System

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • user (str) – Guest Operating Username
  • pwd (str) – Guest Operating Username password
  • cmd (str) – Command to execute
  • arg (str) – Command arguments
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

Note

more information about required attributes available in Virtual Machine Attributes

set_vm_cpu(uuid, number, **kwargs)[source]

Updates Virtual Machine CPU count

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • number (int) – New vCPU count
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

set_vm_memory(uuid, sizeGB, **kwargs)[source]

Updates Virtual Machine Memory size

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • sizeGB (int) – New memory size in GB
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

shutdown_vm(uuid, **kwargs)[source]

Graceful shutdown VM. This method sends a shutdown signal via VMware Tools to the Guest Operating system, thus VMware Tools is required up-to-date and running on VM.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

keyword arguments include schedule to process request on a given date and time

unmount_vm_tools(uuid, **kwargs)[source]

Unmounts VMware official distribution of VMware Tools in Guest Operating system

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

This method fails if VMware Tools ISO is not mounted in guest OS

Note

keyword arguments include schedule to process request on a given date and time

update_user_email_settings(attribute, value)[source]

Updates user email notification settings for a given attribute and value

Parameters:
  • attribute (str) – attribute to update. could be <error|none|completion|submission>
  • value (bool) – True or false
Returns:

updated email settings object

update_vm_alarm(uuid, moref, **kwargs)[source]

Updates given Virtual Machine Alarm

Parameters:
  • uuid (str) – Virtual Machine uuid
  • moref – Virtual Machine Alarm managed object reference
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_boot(uuid, attribute, value, **kwargs)[source]

Helper function to update boot configuration

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • attribute – Either boot bios or boot delay
  • value – int or bool
Returns:

change request object

Note

keywords arguments include schedule to process request on a given date and time

update_vm_boot_bios(uuid, boot_bios, **kwargs)[source]

Updates boot to bios configuration

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • boot_bios (bool) – Enable or disable
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_boot_delay(uuid, boot_delay_ms, **kwargs)[source]

Updates boot bios delay configuration

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • boot_delay_ms (int) – boot delay in milliseconds
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_cd(uuid, cd, iso=None, **kwargs)[source]

Updates given CD unit backing to client or ISO.

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • cd (int) – CD/DVD unit
  • iso (str) – full path to ISO
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_disk_capacity(uuid, disk, valueGB, **kwargs)[source]

Updates given Virtual Machine disk capacity

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • disk (int) – unit to update
  • valueGB (int) – New capacity in GB
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_domain(uuid, moref, power_on=False, force=False, **kwargs)[source]

Updates fault domain of given VM

Parameters:
  • uuid (str) – Virtual Machine uuid
  • moref (str) – Target domain managed object reference
  • power_on (bool) – Whether VM will be powered of after migration
  • force (bool) – If set to True, VM will be powered off prior migration
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

See also

get_domains() for domain parameter

update_vm_floppy(uuid, floppy, image=None, **kwargs)[source]

Updates given Floppy unit backing to client or image.

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • floppy (int) – floppy unit
  • image (str) – full path to ISO
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_folder(uuid, folder_moId, **kwargs)[source]

Moves VM to a given folder

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • folder_moId (str) – folder managed object reference
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_nic_network(uuid, nic, network, **kwargs)[source]

Updates Virtual Machine network on a given nic

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • nic (int) – Network interface card number
  • network (str) – new network moref
Returns:

change request object

Note

keywords arguments include schedule to process request on a given date and time

update_vm_nic_state(uuid, nic, state, **kwargs)[source]

Updates Virtual Machine NIC state

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • nic (int) – Network interface card number
  • state (str) – new nic state (connect, disconnect)
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_nic_type(uuid, nic, type, **kwargs)[source]

Updates Virtual Machine NIC type

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • nic (int) – Network interface card number
  • type (str) – new nic type (E1000e, E1000, VMXNET3, VMXNET2)
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_note(uuid, notes_list, **kwargs)[source]

Update Virtual Machine client notes. Notes are stored as key-value metadata items.

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • notes_list (list) – key=value string items
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_os(uuid, os, **kwargs)[source]

Updates Virtual Machine Operating System configuration

Parameters:
  • uuid (str) – Virtual Machine uuid
  • os (str) – Operating system id.
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

See also

get_os() for os parameter

update_vm_state(uuid, state, **kwargs)[source]

Updates given Virtual Machine power state

Parameters:
  • uuid (str) – Virtual Machine uuid
  • state (str) – Desired state
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_tools(uuid, action, **kwargs)[source]

Helper method to manage VMware tools on Virtual Machiene.

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • action (str) – Either mount, unmount or upgrade actions
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_vss_admin(uuid, name, phone, email, **kwargs)[source]

Update Virtual Machine administrator contact info.

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • name (str) – Full name of VM admin
  • phone (str) – Valid phone number of VM admin
  • email (str) – Valid email address of VM admin
Returns:

change request object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_vss_ha_group(uuid, vms, append=True, **kwargs)[source]

Updates High Availability Group This is part of the VSS metadata added to the VM annotation

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • vms (list) – list of virtual machine Uuids
  • append (bool) – whether to replace or append
Returns:

object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_vss_inform(uuid, emails, append=True, **kwargs)[source]

Updates informational contacts This is part of the VSS metadata added to the VM annotation

Parameters:
  • uuid (str) – Virtual Machine Uuid
  • emails (list) – list of email(s)
  • append (bool) – whether to replace or append
Returns:

object

Note

keyword arguments include schedule to process request on a given date and time

update_vm_vss_usage(uuid, usage, **kwargs)[source]
Parameters:
  • uuid (str) – Virtual Machine Uuid
  • usage (str) – New usage (Prod, Dev, Test or QA)
Returns:

change request

Note

keyword arguments include schedule to process request on a given date and time

upgrade_vm_tools(uuid, **kwargs)[source]

Upgrade VMware Tools if Virtual Machine is using the official VMware Tools version.

Parameters:uuid (str) – Virtual Machine Uuid
Returns:change request object

Note

This method fails if Guest OS is running an unmanaged distribution of VMware Tools.

Note

keyword arguments include schedule to process request on a given date and time

upgrade_vm_version(uuid, when, **kwargs)[source]
Parameters:
  • uuid (str) – Virtual Machine Uuid
  • when (str) – perform upgrade now or on next boot
Returns:

change request object

user_agent = 'pyvss/0.8.7'
static validate_build_process(built)[source]
static validate_usage(usage)[source]
wait_for_request(request_url, request_attr, required_status, max_tries=6)[source]

Waits for request to be in any given status

Parameters:
  • request_url (str) – Request URL to check periodically
  • request_attr (str) – Attribute to return upon completion
  • required_status (str) – Required request status.
  • max_tries (int) – Maximum tries to check. Defaults to 6 and every try waits for 10 secs
Returns:

False if failed or the type of attribute requested

whoami()[source]

Retrieves current user summary

Returns:object
pyvss.manager.run_main()[source]

Simple wrapper to execute manager functions

Checks for VSS_API_TOKEN environment variable

Example:

python pyvss/manager.py get_vms 'summary=1&name=pm'

Helper

This helper module contains complimentary functions to the pyvss.manager module

class pyvss.helper.HTTPBasicAuth(username, password)[source]

Bases: requests.auth.HTTPBasicAuth

static make_header(username, password)[source]
pyvss.helper.compress_encode_string(string_data)[source]

Compresses and encodes in base64 a given string

Parameters:string_data (str) – string to compress and encode
Returns:compressed and encoded string
pyvss.helper.decode_uncompress_string(string_gz_encoded)[source]

Decompress and decodes a given string

Parameters:string_gz_encoded (str) – string to decompress and decode
Returns:string
pyvss.helper.hash_string(string_to_hash)[source]

Hashes string using SHA-512

Parameters:string_to_hash (str) – string to hash
Returns:hashed string

Exceptions

exception pyvss.exceptions.VssError[source]

Bases: exceptions.RuntimeError