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.VapiInterface
The
CheckOuts
class 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.VapiStruct
The
CheckOuts.CheckInSpec
class 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.VapiStruct
The
CheckOuts.CheckOutSpec
class 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 (
str
orNone
) – 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.PlacementSpec
orNone
) –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 (
bool
orNone
) – 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.VapiStruct
The
CheckOuts.Info
class 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.VapiStruct
The
CheckOuts.PlacementSpec
class 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 (
str
orNone
) – 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 (
str
orNone
) – 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 (
str
orNone
) – Host onto which the virtual machine should be placed. Ifhost
andresourcePool
are both specified,resourcePool
must belong tohost
. Ifhost
andcluster
are both specified,host
must 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 ifresourcePool
orcluster
is 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 (
str
orNone
) – Cluster onto which the virtual machine should be placed. Ifcluster
andresourcePool
are both specified,resourcePool
must belong tocluster
. Ifcluster
andhost
are both specified,host
must 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
. IfresourcePool
orhost
is specified, it is recommended that this attribute be None.
-
class
Summary
(vm=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStruct
The
CheckOuts.Summary
class 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
Versions
class. 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.CheckInSpec
orNone
) – 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.InvalidArgument
if any of the specified parameters are invalid.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the virtual machine identified byvm
was not checked out of the item specified bytemplate_library_item
.- Raise
com.vmware.vapi.std.errors_client.NotAllowedInCurrentState
if 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.NotFound
if the item specified bytemplate_library_item
does not exist.- Raise
com.vmware.vapi.std.errors_client.NotFound
if the virtual machine specified byvm
does not exist.- Raise
com.vmware.vapi.std.errors_client.ResourceInaccessible
if there is an error accessing a file from the virtual machine.- Raise
com.vmware.vapi.std.errors_client.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresContentLibrary.CheckInTemplate
.The resource
VirtualMachine
referenced by the parametervm
requiresSystem.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.CheckOutSpec
orNone
) – 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.AlreadyExists
if a virtual machine with the name specified byCheckOuts.CheckOutSpec.name
already exists in the folder specified byCheckOuts.PlacementSpec.folder
.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
ifspec
contains invalid arguments.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the library item is a member of a subscribed library.- Raise
com.vmware.vapi.std.errors_client.NotFound
if the library item specified bytemplate_library_item
cannot be found.- Raise
com.vmware.vapi.std.errors_client.ResourceInaccessible
if 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.UnableToAllocateResource
if 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.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresContentLibrary.CheckOutTemplate
.The resource
Folder
referenced by the attributeCheckOuts.PlacementSpec.folder
requiresSystem.Read
.The resource
ResourcePool
referenced by the attributeCheckOuts.PlacementSpec.resource_pool
requiresSystem.Read
.The resource
HostSystem
referenced by the attributeCheckOuts.PlacementSpec.host
requiresSystem.Read
.The resource
ClusterComputeResource
referenced by the attributeCheckOuts.PlacementSpec.cluster
requiresSystem.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.NotFound
if the library item or virtual machine is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the virtual machine is not checked out of the library item.- Raise
com.vmware.vapi.std.errors_client.NotAllowedInCurrentState
if the virtual machine is running (powered on).- Raise
com.vmware.vapi.std.errors_client.ResourceBusy
if the virtual machine is busy performing another operation.- Raise
com.vmware.vapi.std.errors_client.ResourceInaccessible
if the virtual machine’s configuration state cannot be accessed.- Raise
com.vmware.vapi.std.errors_client.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
VirtualMachine
referenced by the parametervm
requiresVirtualMachine.Inventory.Delete
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresSystem.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.NotFound
if the library item or virtual machine is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the virtual machine is not checked out of the library item.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresSystem.Read
.The resource
VirtualMachine
referenced by the parametervm
requiresSystem.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.NotFound
if the library item is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresSystem.Read
.
-
class
com.vmware.vcenter.vm_template.library_items_client.
StubFactory
(stub_config)¶ Bases:
vmware.vapi.bindings.stub.StubFactoryBase
Initialize 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.VapiInterface
The
Versions
class 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.VapiStruct
The
Versions.Info
class 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.VapiStruct
The
Versions.RollbackSpec
class 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.VapiStruct
The
Versions.Summary
class 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.NotFound
if the library item or version is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the specified version is the latest version of the library item.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.ResourceInaccessible
if the virtual machine template’s configuration state cannot be accessed.- Raise
com.vmware.vapi.std.errors_client.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresContentLibrary.DeleteLibraryItem
.The resource
com.vmware.content.library.item.Version
referenced by the parameterversion
requiresSystem.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.NotFound
if the library item or version is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresSystem.Read
.The resource
com.vmware.content.library.item.Version
referenced by the parameterversion
requiresSystem.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.NotFound
if the library item is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresSystem.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.RollbackSpec
orNone
) – 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.NotFound
if the library item or version is not found.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the specified version is the latest version of the library item.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the library item does not contain a virtual machine template.- Raise
com.vmware.vapi.std.errors_client.NotAllowedInCurrentState
if a virtual machine is checked out of the library item.- Raise
com.vmware.vapi.std.errors_client.Unauthenticated
if the user that requested the method cannot be authenticated.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if the user that requested the method is not authorized to perform the method.- Raise
com.vmware.vapi.std.errors_client.Error
if the system reports an error while responding to the request.- Raise
com.vmware.vapi.std.errors_client.Unauthorized
if you do not have all of the privileges described as follows:Method execution requires
System.Read
.The resource
com.vmware.content.library.Item
referenced by the parametertemplate_library_item
requiresContentLibrary.CheckInTemplate
.The resource
com.vmware.content.library.item.Version
referenced by the parameterversion
requiresSystem.Read
.