com.vmware.vcenter.vm_template package¶
Submodules¶
com.vmware.vcenter.vm_template.library_items_client module¶
The com.vmware.vcenter.vm_template.library_items_client module provides
classes and classes for managing virtual machine template library items. This
includes methods for checking out virtual machine template library items and
querying previous versions of checked in virtual machines.
-
class
com.vmware.vcenter.vm_template.library_items_client.CheckOuts(config)¶ Bases:
vmware.vapi.bindings.stub.VapiInterfaceThe
CheckOutsclass provides methods for managing the checkouts of a library item containing a virtual machine template. This class provides operations to check out a library item to update the virtual machine template, and to check in the library item when the virtual machine changes are complete. This class was added in vSphere API 6.9.1.- Parameters
config (
vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
-
class
CheckInSpec(message=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStructThe
CheckOuts.CheckInSpecclass defines the information required to check in a virtual machine into a library item. This class was added in vSphere API 6.9.1.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
message (
str) – Message describing the changes made to the virtual machine. This attribute was added in vSphere API 6.9.1.
-
class
CheckOutSpec(name=None, placement=None, powered_on=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStructThe
CheckOuts.CheckOutSpecclass defines the information required to check out a library item containing a virtual machine template. This class was added in vSphere API 6.9.1.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
name (
strorNone) – Name of the virtual machine to check out of the library item. This attribute was added in vSphere API 6.9.1. This attribute is currently required. In the future, if this attribute is None, the system will choose a suitable name for the virtual machine.placement (
CheckOuts.PlacementSpecorNone) –Information used to place the checked out virtual machine. This attribute was added in vSphere API 6.9.1. This attribute is currently required. In the future, if this attribute is None, the system will place the virtual machine on a suitable resource.
If specified, each attribute will be used for placement. If the attributes result in disjoint placement, the operation will fail. If the attributes along with the placement values of the source virtual machine template result in disjoint placement, the operation will fail.
powered_on (
boolorNone) – Specifies whether the virtual machine should be powered on after check out. This attribute was added in vSphere API 6.9.1. If None, the virtual machine will not be powered on after check out.
-
class
Info(time=None, user=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStructThe
CheckOuts.Infoclass contains information about a checked out virtual machine. This class was added in vSphere API 6.9.1.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
time (
datetime.datetime) – Date and time when the virtual machine was checked out. This attribute was added in vSphere API 6.9.1.user (
str) – Name of the user who checked out the virtual machine. This attribute was added in vSphere API 6.9.1.
-
class
PlacementSpec(folder=None, resource_pool=None, host=None, cluster=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStructThe
CheckOuts.PlacementSpecclass contains information used to place a checked out virtual machine onto resources within the vCenter inventory. The specified compute resource should have access to the storage associated with the checked out virtual machine. This class was added in vSphere API 6.9.1.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
folder (
strorNone) – Virtual machine folder into which the virtual machine should be placed. This attribute was added in vSphere API 6.9.1. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:Folder. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:Folder. If None, the virtual machine will be placed in the same folder as the source virtual machine template.resource_pool (
strorNone) – Resource pool into which the virtual machine should be placed. This attribute was added in vSphere API 6.9.1. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:ResourcePool. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:ResourcePool. If None, the system will attempt to choose a suitable resource pool for the virtual machine; if a resource pool cannot be chosen, the operation will fail.host (
strorNone) – Host onto which the virtual machine should be placed. IfhostandresourcePoolare both specified,resourcePoolmust belong tohost. Ifhostandclusterare both specified,hostmust be a member ofcluster. This attribute was added in vSphere API 6.9.1. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:HostSystem. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:HostSystem. This attribute may be None ifresourcePoolorclusteris specified. If None, the system will attempt to choose a suitable host for the virtual machine; if a host cannot be chosen, the operation will fail.cluster (
strorNone) – Cluster onto which the virtual machine should be placed. IfclusterandresourcePoolare both specified,resourcePoolmust belong tocluster. Ifclusterandhostare both specified,hostmust be a member ofcluster. This attribute was added in vSphere API 6.9.1. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:ClusterComputeResource. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:ClusterComputeResource. IfresourcePoolorhostis specified, it is recommended that this attribute be None.
-
class
Summary(vm=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStructThe
CheckOuts.Summaryclass contains commonly used information about a checked out virtual machine. This class was added in vSphere API 6.9.1.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
vm (
str) – Identifier of the checked out virtual machine. This attribute was added in vSphere API 6.9.1. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:VirtualMachine. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:VirtualMachine.
-
check_in(template_library_item, vm, spec=None)¶ Checks in a virtual machine into the library item. This method updates the library item to contain the virtual machine being checked in as a template. This template becomes the latest version of the library item. The previous virtual machine template contained in the library item is available as a backup and its information can be queried using the
Versionsclass. At most one previous version of a virtual machine template is retained in the library item. This method was added in vSphere API 6.9.1.- Parameters
template_library_item (
str) – Identifier of the content library item in which the virtual machine is checked in. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.vm (
str) – Identifier of the virtual machine to check into the library item. The parameter must be an identifier for the resource type:VirtualMachine.spec (
CheckOuts.CheckInSpecorNone) – Specification used to check in the virtual machine into the library item. This parameter is currently required. In the future, if this parameter is None, the system will apply suitable defaults.
- Return type
str- Returns
The new version of the library item. The return value will be an identifier for the resource type:
com.vmware.content.library.item.Version.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif any of the specified parameters are invalid.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the virtual machine identified byvmwas not checked out of the item specified bytemplate_library_item.- Raise
com.vmware.vapi.std.errors_client.NotAllowedInCurrentStateif the method cannot be performed because of the virtual machine’s current state. For example, if the virtual machine is not powered off.- Raise
com.vmware.vapi.std.errors_client.NotFoundif the item specified bytemplate_library_itemdoes not exist.- Raise
com.vmware.vapi.std.errors_client.NotFoundif the virtual machine specified byvmdoes not exist.- Raise
com.vmware.vapi.std.errors_client.ResourceInaccessibleif there is an error accessing a file from the virtual machine.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresContentLibrary.CheckInTemplate.The resource
VirtualMachinereferenced by the parametervmrequiresSystem.Read.
-
check_out(template_library_item, spec=None)¶ Checks out a library item containing a virtual machine template. This method makes a copy of the source virtual machine template contained in the library item as a virtual machine. The virtual machine is copied with the same storage specification as the source virtual machine template. Changes to the checked out virtual machine do not affect the virtual machine template contained in the library item. To save these changes back into the library item,
CheckOuts.check_in()the virtual machine. To discard the changes,CheckOuts.delete()the virtual machine. This method was added in vSphere API 6.9.1.- Parameters
template_library_item (
str) – Identifier of the content library item containing the source virtual machine template to be checked out. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.spec (
CheckOuts.CheckOutSpecorNone) – Specification used to check out the source virtual machine template as a virtual machine. This parameter is currently required. In the future, if this parameter is None, the system will apply suitable defaults.
- Return type
str- Returns
Identifier of the virtual machine that was checked out of the library item. The return value will be an identifier for the resource type:
VirtualMachine.- Raise
com.vmware.vapi.std.errors_client.AlreadyExistsif a virtual machine with the name specified byCheckOuts.CheckOutSpec.namealready exists in the folder specified byCheckOuts.PlacementSpec.folder.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentifspeccontains invalid arguments.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the library item is a member of a subscribed library.- Raise
com.vmware.vapi.std.errors_client.NotFoundif the library item specified bytemplate_library_itemcannot be found.- Raise
com.vmware.vapi.std.errors_client.ResourceInaccessibleif there is an error accessing the files of the source virtual machine template contained in the library item specified bytemplate_library_item.- Raise
com.vmware.vapi.std.errors_client.UnableToAllocateResourceif the limit for the number of virtual machines checked out of a library item (currently 1) has been exceeded.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresContentLibrary.CheckOutTemplate.The resource
Folderreferenced by the attributeCheckOuts.PlacementSpec.folderrequiresSystem.Read.The resource
ResourcePoolreferenced by the attributeCheckOuts.PlacementSpec.resource_poolrequiresSystem.Read.The resource
HostSystemreferenced by the attributeCheckOuts.PlacementSpec.hostrequiresSystem.Read.The resource
ClusterComputeResourcereferenced by the attributeCheckOuts.PlacementSpec.clusterrequiresSystem.Read.
-
delete(template_library_item, vm)¶ Deletes the checked out virtual machine. This method was added in vSphere API 6.9.1.
- Parameters
template_library_item (
str) – Identifier of the VM template library item. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.vm (
str) – Identifier of the checked out virtual machine to delete. The parameter must be an identifier for the resource type:VirtualMachine.
- Raise
com.vmware.vapi.std.errors_client.NotFoundif the library item or virtual machine is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the virtual machine is not checked out of the library item.- Raise
com.vmware.vapi.std.errors_client.NotAllowedInCurrentStateif the virtual machine is running (powered on).- Raise
com.vmware.vapi.std.errors_client.ResourceBusyif the virtual machine is busy performing another operation.- Raise
com.vmware.vapi.std.errors_client.ResourceInaccessibleif the virtual machine’s configuration state cannot be accessed.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
VirtualMachinereferenced by the parametervmrequiresVirtualMachine.Inventory.Delete.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresSystem.Read.
-
get(template_library_item, vm)¶ Returns the information about a checked out virtual machine. This method was added in vSphere API 6.9.1.
- Parameters
template_library_item (
str) – Identifier of the VM template library item. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.vm (
str) – Identifier of the checked out virtual machine. The parameter must be an identifier for the resource type:VirtualMachine.
- Return type
- Returns
Information about a check out.
- Raise
com.vmware.vapi.std.errors_client.NotFoundif the library item or virtual machine is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the virtual machine is not checked out of the library item.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresSystem.Read.The resource
VirtualMachinereferenced by the parametervmrequiresSystem.Read.
-
list(template_library_item)¶ Returns commonly used information about the virtual machines that are checked out of the library item. This method was added in vSphere API 6.9.1.
- Parameters
template_library_item (
str) – Identifier of the VM template library item. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.- Return type
- Returns
List of commonly used information about the check outs.
- Raise
com.vmware.vapi.std.errors_client.NotFoundif the library item is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresSystem.Read.
-
class
com.vmware.vcenter.vm_template.library_items_client.StubFactory(stub_config)¶ Bases:
vmware.vapi.bindings.stub.StubFactoryBaseInitialize StubFactoryBase
- Parameters
stub_config (
vmware.vapi.bindings.stub.StubConfiguration) – Stub config instance
-
class
com.vmware.vcenter.vm_template.library_items_client.Versions(config)¶ Bases:
vmware.vapi.bindings.stub.VapiInterfaceThe
Versionsclass provides methods for managing the live versions of the virtual machine templates contained in a library item. Live versions include the latest and previous virtual machine templates that are available on disk. As new versions of virtual machine templates are checked in, old versions of virtual machine templates are automatically purged. Currently, at most one previous virtual machine template version is stored. This class was added in vSphere API 6.9.1.- Parameters
config (
vmware.vapi.bindings.stub.StubConfiguration) – Configuration to be used for creating the stub.
-
class
Info(vm_template=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStructThe
Versions.Infoclass contains information about a version of a library item containing a virtual machine template. This class was added in vSphere API 6.9.1.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
vm_template (
str) – Identifier of the virtual machine template associated with the library item version. This attribute is the managed object identifier used to identify the virtual machine template in the vSphere Management (SOAP) API. This attribute was added in vSphere API 6.9.1.
-
RESOURCE_TYPE= 'com.vmware.content.library.item.Version'¶ Resource type for library item versions. This class attribute was added in vSphere API 6.9.1.
-
class
RollbackSpec(message=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStructThe
Versions.RollbackSpecclass defines the information required to rollback a virtual machine template library item to a previous version. This class was added in vSphere API 6.9.1.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
message (
str) – Message describing the reason for the rollback. This attribute was added in vSphere API 6.9.1.
-
class
Summary(version=None, vm_template=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStructThe
Versions.Summaryclass contains commonly used information about a version of a library item containing a virtual machine template. This class was added in vSphere API 6.9.1.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
version (
str) – The version of the library item. This attribute was added in vSphere API 6.9.1. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:com.vmware.content.library.item.Version. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:com.vmware.content.library.item.Version.vm_template (
str) – Identifier of the virtual machine template associated with the library item version. This attribute is the managed object identifier used to identify the virtual machine template in the vSphere Management (SOAP) API. This attribute was added in vSphere API 6.9.1.
-
delete(template_library_item, version)¶ Deletes the virtual machine template contained in the library item at the specified version. This method was added in vSphere API 6.9.1.
- Parameters
template_library_item (
str) – Identifier of the VM template library item. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.version (
str) – Version of the library item to delete. The parameter must be an identifier for the resource type:com.vmware.content.library.item.Version.
- Raise
com.vmware.vapi.std.errors_client.NotFoundif the library item or version is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the specified version is the latest version of the library item.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.ResourceInaccessibleif the virtual machine template’s configuration state cannot be accessed.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresContentLibrary.DeleteLibraryItem.The resource
com.vmware.content.library.item.Versionreferenced by the parameterversionrequiresSystem.Read.
-
get(template_library_item, version)¶ Returns information about the live version of a library item containing a virtual machine template. This method was added in vSphere API 6.9.1.
- Parameters
template_library_item (
str) – Identifier of the VM template library item. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.version (
str) – Version of the library item. The parameter must be an identifier for the resource type:com.vmware.content.library.item.Version.
- Return type
- Returns
Information about the specified library item version.
- Raise
com.vmware.vapi.std.errors_client.NotFoundif the library item or version is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresSystem.Read.The resource
com.vmware.content.library.item.Versionreferenced by the parameterversionrequiresSystem.Read.
-
list(template_library_item)¶ Returns commonly used information about the live versions of a virtual machine template library item. This method was added in vSphere API 6.9.1.
- Parameters
template_library_item (
str) – Identifier of the VM template library item. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.- Return type
- Returns
List of commonly used information about the library item versions.
- Raise
com.vmware.vapi.std.errors_client.NotFoundif the library item is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresSystem.Read.
-
rollback(template_library_item, version, spec=None)¶ Rollbacks a library item containing a virtual machine template to a previous version. The virtual machine template at the specified version becomes the latest virtual machine template with a new version identifier. This method was added in vSphere API 6.9.1.
- Parameters
template_library_item (
str) – Identifier of the VM template library item. The parameter must be an identifier for the resource type:com.vmware.content.library.Item.version (
str) – Version of the library item to rollback. The parameter must be an identifier for the resource type:com.vmware.content.library.item.Version.spec (
Versions.RollbackSpecorNone) – Specification to rollback the library item. This parameter is currently required. In the future, if this parameter is None, the system will apply suitable defaults.
- Return type
str- Returns
The new version of the library item. The return value will be an identifier for the resource type:
com.vmware.content.library.item.Version.- Raise
com.vmware.vapi.std.errors_client.NotFoundif the library item or version is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the specified version is the latest version of the library item.- Raise
com.vmware.vapi.std.errors_client.InvalidArgumentif the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.NotAllowedInCurrentStateif a virtual machine is checked out of the library item.- Raise
com.vmware.vapi.std.errors_client.Unauthenticatedif the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Errorif the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorizedif you do not have all of the privileges described as follows:Method execution requires
System.Read.The resource
com.vmware.content.library.Itemreferenced by the parametertemplate_library_itemrequiresContentLibrary.CheckInTemplate.The resource
com.vmware.content.library.item.Versionreferenced by the parameterversionrequiresSystem.Read.