pyvcloud.vcd.client module¶
-
class
pyvcloud.vcd.client.
BasicLoginCredentials
(user, org, password)¶ Bases:
object
-
class
pyvcloud.vcd.client.
Client
(uri, api_version='6.0', verify_ssl_certs=True, log_file=None, log_requests=False, log_headers=False, log_bodies=False)¶ Bases:
object
A low-level interface to the vCloud Director REST API.
-
delete_linked_resource
(resource, rel, media_type)¶ Deletes the resource referenced by the link.
- Deletes the resource referenced by the link with the specified rel and
- mediaType in the specified resource.
-
delete_resource
(uri, force=False, recursive=False)¶
-
download_from_uri
(uri, file_name, chunk_size=1048576, size=0, callback=None)¶
-
get_admin
()¶ Returns the “admin” root resource type.
-
get_api_uri
()¶
-
get_extensibility
()¶ Returns the ‘extensibility’ resource type.
-
get_extension
()¶ Returns the ‘extension’ resource type.
-
get_linked_resource
(resource, rel, media_type)¶ Gets the content of the resource link.
- Gets the contents of the resource referenced by the link with the
- specified rel and mediaType in the specified resource.
-
get_org
()¶ Returns the logged in org.
-
get_org_by_name
(org_name)¶ Retrieve an organization.
Parameters: org_name – name of the org to be retrieved. Returns: Org record.
-
get_org_list
()¶ Returns the list of organizationsself.
-
get_query_list
()¶ Returns the list of supported queries.
-
get_resource
(uri, objectify_results=True)¶ Gets the specified contents to the specified resource.
This method does an HTTP GET.
-
get_supported_versions
()¶
-
get_task_monitor
()¶
-
get_typed_query
(query_type_name, query_result_format=<EnumValue: QueryResultFormat.REFERENCES [value=('application/vnd.vmware.vcloud.query.references+xml', 'references')]>, page_size=None, include_links=False, qfilter=None, equality_filter=None, sort_asc=None, sort_desc=None, fields=None)¶
-
get_user_in_org
(user_name, org_href)¶ Retrieve user from a particular org.
Parameters: - user_name – user name to be retrieved.
- org_href – org where the user belongs.
Returns: A
lxml.objectify.StringElement
object representing the user
-
is_sysadmin
()¶
-
logout
()¶
-
post_linked_resource
(resource, rel, media_type, contents)¶ Posts to a resource link.
- Posts the contents of the resource referenced by the link with the
- specified rel and mediaType in the specified resource.
-
post_resource
(uri, contents, media_type, objectify_results=True)¶ Posts to a resource link.
- Posts the specified contents to the specified resource.
- (Does an HTTP POST.)
-
put_linked_resource
(resource, rel, media_type, contents)¶ Puts to a resource link.
- Puts the contents of the resource referenced by the link with the
- specified rel and mediaType in the specified resource.
-
put_resource
(uri, contents, media_type, objectify_results=True)¶ Puts the specified contents to the specified resource.
This method does an HTTP PUT.
-
rehydrate
(state)¶
-
rehydrate_from_token
(token)¶
-
set_credentials
(creds)¶ Sets the credentials used for authentication.
-
set_highest_supported_version
()¶
-
upload_fragment
(uri, contents, range_str)¶
-
-
class
pyvcloud.vcd.client.
EntityType
¶ Bases:
flufl.enum._enum.Enum
-
ADMIN
= <EnumValue: EntityType.ADMIN [value=application/vnd.vmware.admin.vcloud+xml]>¶
-
ADMIN_CATALOG
= <EnumValue: EntityType.ADMIN_CATALOG [value=application/vnd.vmware.admin.catalog+xml]>¶
-
ADMIN_ORG
= <EnumValue: EntityType.ADMIN_ORG [value=application/vnd.vmware.admin.organization+xml]>¶
-
ADMIN_SERVICE
= <EnumValue: EntityType.ADMIN_SERVICE [value=application/vnd.vmware.admin.service+xml]>¶
-
AMQP_SETTINGS
= <EnumValue: EntityType.AMQP_SETTINGS [value=application/vnd.vmware.admin.amqpSettings+xml]>¶
-
API_EXTENSIBILITY
= <EnumValue: EntityType.API_EXTENSIBILITY [value=application/vnd.vmware.vcloud.apiextensibility+xml]>¶
-
CAPTURE_VAPP_PARAMS
= <EnumValue: EntityType.CAPTURE_VAPP_PARAMS [value=application/vnd.vmware.vcloud.captureVAppParams+xml]>¶
-
CATALOG
= <EnumValue: EntityType.CATALOG [value=application/vnd.vmware.vcloud.catalog+xml]>¶
-
COMPOSE_VAPP_PARAMS
= <EnumValue: EntityType.COMPOSE_VAPP_PARAMS [value=application/vnd.vmware.vcloud.composeVAppParams+xml]>¶
-
CONTROL_ACCESS_PARAMS
= <EnumValue: EntityType.CONTROL_ACCESS_PARAMS [value=application/vnd.vmware.vcloud.controlAccess+xml]>¶
-
DEPLOY
= <EnumValue: EntityType.DEPLOY [value=application/vnd.vmware.vcloud.deployVAppParams+xml]>¶
-
DISK
= <EnumValue: EntityType.DISK [value=application/vnd.vmware.vcloud.disk+xml]>¶
-
DISK_ATTACH_DETACH_PARAMS
= <EnumValue: EntityType.DISK_ATTACH_DETACH_PARAMS [value=application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml]>¶
-
DISK_CREATE_PARMS
= <EnumValue: EntityType.DISK_CREATE_PARMS [value=application/vnd.vmware.vcloud.diskCreateParams+xml]>¶
-
EDGE_GATEWAY
= <EnumValue: EntityType.EDGE_GATEWAY [value=application/vnd.vmware.admin.edgeGateway+xml]>¶
-
EDGE_GATEWAY_SERVICE_CONFIGURATION
= <EnumValue: EntityType.EDGE_GATEWAY_SERVICE_CONFIGURATION [value=application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml]>¶
-
EXTENSION
= <EnumValue: EntityType.EXTENSION [value=application/vnd.vmware.admin.vmwExtension+xml]>¶
-
EXTENSION_SERVICES
= <EnumValue: EntityType.EXTENSION_SERVICES [value=application/vnd.vmware.admin.extensionServices+xml]>¶
-
EXTERNAL_NETWORK_REFS
= <EnumValue: EntityType.EXTERNAL_NETWORK_REFS [value=application/vnd.vmware.admin.vmwExternalNetworkReferences+xml]>¶
-
INSTANTIATE_VAPP_TEMPLATE_PARAMS
= <EnumValue: EntityType.INSTANTIATE_VAPP_TEMPLATE_PARAMS [value=application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml]>¶
-
LEASE_SETTINGS
= <EnumValue: EntityType.LEASE_SETTINGS [value=application/vnd.vmware.vcloud.leaseSettingsSection+xml]>¶
-
MEDIA
= <EnumValue: EntityType.MEDIA [value=application/vnd.vmware.vcloud.media+xml]>¶
-
METADATA
= <EnumValue: EntityType.METADATA [value=application/vnd.vmware.vcloud.metadata+xml]>¶
-
NETWORK_CONFIG_SECTION
= <EnumValue: EntityType.NETWORK_CONFIG_SECTION [value=application/vnd.vmware.vcloud.networkConfigSection+xml]>¶
-
NETWORK_CONNECTION_SECTION
= <EnumValue: EntityType.NETWORK_CONNECTION_SECTION [value=application/vnd.vmware.vcloud.networkConnectionSection+xml]>¶
-
NETWORK_POOL_REFERENCES
= <EnumValue: EntityType.NETWORK_POOL_REFERENCES [value=application/vnd.vmware.admin.vmwNetworkPoolReferences+xml]>¶
-
ORG
= <EnumValue: EntityType.ORG [value=application/vnd.vmware.vcloud.org+xml]>¶
-
ORG_LIST
= <EnumValue: EntityType.ORG_LIST [value=application/vnd.vmware.vcloud.orgList+xml]>¶
-
ORG_NETWORK
= <EnumValue: EntityType.ORG_NETWORK [value=application/vnd.vmware.vcloud.orgNetwork+xml]>¶
-
ORG_RIGHTS
= <EnumValue: EntityType.ORG_RIGHTS [value=application/vnd.vmware.admin.org.rights+xml]>¶
-
ORG_VDC_NETWORK
= <EnumValue: EntityType.ORG_VDC_NETWORK [value=application/vnd.vmware.vcloud.orgVdcNetwork+xml]>¶
-
OWNER
= <EnumValue: EntityType.OWNER [value=application/vnd.vmware.vcloud.owner+xml]>¶
-
PROVIDER_VDC_PARAMS
= <EnumValue: EntityType.PROVIDER_VDC_PARAMS [value=application/vnd.vmware.admin.createProviderVdcParams+xml]>¶
-
PUBLISH_CATALOG_PARAMS
= <EnumValue: EntityType.PUBLISH_CATALOG_PARAMS [value=application/vnd.vmware.admin.publishCatalogParams+xml]>¶
-
QUERY_LIST
= <EnumValue: EntityType.QUERY_LIST [value=application/vnd.vmware.vcloud.query.queryList+xml]>¶
-
RASD_ITEM
= <EnumValue: EntityType.RASD_ITEM [value=application/vnd.vmware.vcloud.rasdItem+xml]>¶
-
RASD_ITEMS_LIST
= <EnumValue: EntityType.RASD_ITEMS_LIST [value=application/vnd.vmware.vcloud.rasdItemsList+xml]>¶
-
RECOMPOSE_VAPP_PARAMS
= <EnumValue: EntityType.RECOMPOSE_VAPP_PARAMS [value=application/vnd.vmware.vcloud.recomposeVAppParams+xml]>¶
-
RECORDS
= <EnumValue: EntityType.RECORDS [value=application/vnd.vmware.vcloud.query.records+xml]>¶
-
REGISTER_VC_SERVER_PARAMS
= <EnumValue: EntityType.REGISTER_VC_SERVER_PARAMS [value=application/vnd.vmware.admin.registerVimServerParams+xml]>¶
-
RIGHT
= <EnumValue: EntityType.RIGHT [value=application/vnd.vmware.admin.right+xml]>¶
-
ROLE
= <EnumValue: EntityType.ROLE [value=application/vnd.vmware.admin.role+xml]>¶
-
SNAPSHOT_CREATE
= <EnumValue: EntityType.SNAPSHOT_CREATE [value=application/vnd.vmware.vcloud.createSnapshotParams+xml]>¶
-
SYSTEM_SETTINGS
= <EnumValue: EntityType.SYSTEM_SETTINGS [value=application/vnd.vmware.admin.systemSettings+xml]>¶
-
TASK
= <EnumValue: EntityType.TASK [value=application/vnd.vmware.vcloud.task+xml]>¶
-
TASKS_LIST
= <EnumValue: EntityType.TASKS_LIST [value=application/vnd.vmware.vcloud.tasksList+xml]>¶
-
TEXT_XML
= <EnumValue: EntityType.TEXT_XML [value=text/xml]>¶
-
UNDEPLOY
= <EnumValue: EntityType.UNDEPLOY [value=application/vnd.vmware.vcloud.undeployVAppParams+xml]>¶
-
UPLOAD_VAPP_TEMPLATE_PARAMS
= <EnumValue: EntityType.UPLOAD_VAPP_TEMPLATE_PARAMS [value=application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml]>¶
-
USER
= <EnumValue: EntityType.USER [value=application/vnd.vmware.admin.user+xml]>¶
-
VAPP
= <EnumValue: EntityType.VAPP [value=application/vnd.vmware.vcloud.vApp+xml]>¶
-
VAPP_TEMPLATE
= <EnumValue: EntityType.VAPP_TEMPLATE [value=application/vnd.vmware.vcloud.vAppTemplate+xml]>¶
-
VDC
= <EnumValue: EntityType.VDC [value=application/vnd.vmware.vcloud.vdc+xml]>¶
-
VDCS_PARAMS
= <EnumValue: EntityType.VDCS_PARAMS [value=application/vnd.vmware.admin.createVdcParams+xml]>¶
-
VDC_REFERENCES
= <EnumValue: EntityType.VDC_REFERENCES [value=application/vnd.vmware.admin.vdcReferences+xml]>¶
-
VIM_SERVER_REFS
= <EnumValue: EntityType.VIM_SERVER_REFS [value=application/vnd.vmware.admin.vmwVimServerReferences+xml]>¶
-
VMS
= <EnumValue: EntityType.VMS [value=application/vnd.vmware.vcloud.vms+xml]>¶
-
-
class
pyvcloud.vcd.client.
FenceMode
¶ Bases:
flufl.enum._enum.Enum
-
BRIDGED
= <EnumValue: FenceMode.BRIDGED [value=bridged]>¶
-
DIRECT
= <EnumValue: FenceMode.DIRECT [value=direct]>¶
-
ISOLATED
= <EnumValue: FenceMode.ISOLATED [value=isolated]>¶
-
NAT_ROUTED
= <EnumValue: FenceMode.NAT_ROUTED [value=natRouted]>¶
-
-
class
pyvcloud.vcd.client.
Link
(link_elem)¶ Bases:
object
Abstraction over <Link> elements.
-
exception
pyvcloud.vcd.client.
LinkException
(href, rel, media_type)¶ Bases:
Exception
-
exception
pyvcloud.vcd.client.
MissingLinkException
(href, rel, media_type)¶
-
exception
pyvcloud.vcd.client.
MissingRecordException
¶ Bases:
Exception
-
exception
pyvcloud.vcd.client.
MultipleLinksException
(href, rel, media_type)¶
-
exception
pyvcloud.vcd.client.
MultipleRecordsException
¶ Bases:
Exception
-
class
pyvcloud.vcd.client.
QueryResultFormat
¶ Bases:
flufl.enum._enum.Enum
-
ID_RECORDS
= <EnumValue: QueryResultFormat.ID_RECORDS [value=('application/vnd.vmware.vcloud.query.idrecords+xml', 'idrecords')]>¶
-
RECORDS
= <EnumValue: QueryResultFormat.RECORDS [value=('application/vnd.vmware.vcloud.query.records+xml', 'records')]>¶
-
REFERENCES
= <EnumValue: QueryResultFormat.REFERENCES [value=('application/vnd.vmware.vcloud.query.references+xml', 'references')]>¶
-
-
class
pyvcloud.vcd.client.
RelationType
¶ Bases:
flufl.enum._enum.Enum
-
ADD
= <EnumValue: RelationType.ADD [value=add]>¶
-
ALTERNATE
= <EnumValue: RelationType.ALTERNATE [value=alternate]>¶
-
CONTROL_ACCESS
= <EnumValue: RelationType.CONTROL_ACCESS [value=controlAccess]>¶
-
DEPLOY
= <EnumValue: RelationType.DEPLOY [value=deploy]>¶
-
DISABLE
= <EnumValue: RelationType.DISABLE [value=disable]>¶
-
DISK_ATTACH
= <EnumValue: RelationType.DISK_ATTACH [value=disk:attach]>¶
-
DISK_DETACH
= <EnumValue: RelationType.DISK_DETACH [value=disk:detach]>¶
-
DOWN
= <EnumValue: RelationType.DOWN [value=down]>¶
-
DOWNLOAD_DEFAULT
= <EnumValue: RelationType.DOWNLOAD_DEFAULT [value=download:default]>¶
-
DOWN_EXTENSIBILITY
= <EnumValue: RelationType.DOWN_EXTENSIBILITY [value=down:extensibility]>¶
-
EDGE_GATEWAYS
= <EnumValue: RelationType.EDGE_GATEWAYS [value=edgeGateways]>¶
-
EDIT
= <EnumValue: RelationType.EDIT [value=edit]>¶
-
ENABLE
= <EnumValue: RelationType.ENABLE [value=enable]>¶
-
LINK_TO_TEMPLATE
= <EnumValue: RelationType.LINK_TO_TEMPLATE [value=linkToTemplate]>¶
-
NEXT_PAGE
= <EnumValue: RelationType.NEXT_PAGE [value=nextPage]>¶
-
ORG_VDC_NETWORKS
= <EnumValue: RelationType.ORG_VDC_NETWORKS [value=orgVdcNetworks]>¶
-
POWER_OFF
= <EnumValue: RelationType.POWER_OFF [value=power:powerOff]>¶
-
POWER_ON
= <EnumValue: RelationType.POWER_ON [value=power:powerOn]>¶
-
POWER_REBOOT
= <EnumValue: RelationType.POWER_REBOOT [value=power:reboot]>¶
-
POWER_RESET
= <EnumValue: RelationType.POWER_RESET [value=power:reset]>¶
-
POWER_SHUTDOWN
= <EnumValue: RelationType.POWER_SHUTDOWN [value=power:shutdown]>¶
-
POWER_SUSPEND
= <EnumValue: RelationType.POWER_SUSPEND [value=power:suspend]>¶
-
RECOMPOSE
= <EnumValue: RelationType.RECOMPOSE [value=recompose]>¶
-
REMOVE
= <EnumValue: RelationType.REMOVE [value=remove]>¶
-
SNAPSHOT_CREATE
= <EnumValue: RelationType.SNAPSHOT_CREATE [value=snapshot:create]>¶
-
SNAPSHOT_REMOVE_ALL
= <EnumValue: RelationType.SNAPSHOT_REMOVE_ALL [value=snapshot:removeAll]>¶
-
SNAPSHOT_REVERT_TO_CURRENT
= <EnumValue: RelationType.SNAPSHOT_REVERT_TO_CURRENT [value=snapshot:revertToCurrent]>¶
-
TASK_CANCEL
= <EnumValue: RelationType.TASK_CANCEL [value=task:cancel]>¶
-
UNDEPLOY
= <EnumValue: RelationType.UNDEPLOY [value=undeploy]>¶
-
UNLINK_FROM_TEMPLATE
= <EnumValue: RelationType.UNLINK_FROM_TEMPLATE [value=unlinkFromTemplate]>¶
-
UP
= <EnumValue: RelationType.UP [value=up]>¶
-
-
class
pyvcloud.vcd.client.
TaskStatus
¶ Bases:
flufl.enum._enum.Enum
-
ABORTED
= <EnumValue: TaskStatus.ABORTED [value=aborted]>¶
-
CANCELED
= <EnumValue: TaskStatus.CANCELED [value=canceled]>¶
-
ERROR
= <EnumValue: TaskStatus.ERROR [value=error]>¶
-
PRE_RUNNING
= <EnumValue: TaskStatus.PRE_RUNNING [value=preRunning]>¶
-
QUEUED
= <EnumValue: TaskStatus.QUEUED [value=queued]>¶
-
RUNNING
= <EnumValue: TaskStatus.RUNNING [value=running]>¶
-
SUCCESS
= <EnumValue: TaskStatus.SUCCESS [value=success]>¶
-
-
exception
pyvcloud.vcd.client.
VcdErrorException
(status_code)¶ Bases:
Exception
-
exception
pyvcloud.vcd.client.
VcdErrorResponseException
(status_code, request_id, vcd_error)¶
-
exception
pyvcloud.vcd.client.
VcdTaskException
(error_message, vcd_error)¶ Bases:
Exception
-
pyvcloud.vcd.client.
find_link
(resource, rel, media_type, fail_if_absent=True)¶ Returns the link of the specified rel and type in the resource.
- @param resource the resource with the link
- @param rel the rel of the desired link
- @param mediaType media type of content
- @param failIfAbsent controls whether an exception is thrown if there’s
- not exactly one link of the specified rel and media type
- @return the link, or null if no such link is present and failIfAbsent
- is false
- @throws MissingLinkException if no link of the specified rel and media
- type is found
- @throws MultipleLinksException if multiple links of the specified rel
- and media type are found
-
pyvcloud.vcd.client.
get_links
(resource, rel=<EnumValue: RelationType.DOWN [value=down]>, media_type=None)¶ Returns all the links of the specified rel and type in the resource.
- @param resource the resource with the link
- @param rel the rel of the desired link
- @param mediaType media type of content
- @return the links (could be an empty list)