VMware vSphere Automation SDK Perl The VMware vSphere Automation SDK for Perl supports the client-side vSphere Automation API for access to vSphere services and capabilities

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Files Functions
Classes | List of all members
Com::Vmware::Vcenter::Ovf::LibraryItem Class Reference
Inheritance diagram for Com::Vmware::Vcenter::Ovf::LibraryItem:

## Classes
class | CreateResult
class | CreateSpec
class | CreateTarget
class | DeployableIdentity
class | DeploymentResult
class | DeploymentTarget
class | OvfSummary
class | ResourcePoolDeploymentSpec
class | ResultInfo
class | StorageGroupMapping

## Avaliable Methods
public method | create ()
public method | deploy ()
public method | filter ()
public method | new ()

## Detailed Description

The `Com::Vmware::Vcenter::Ovf::LibraryItem` interface provides methods to deploy virtual machines and virtual appliances from library items containing Open Virtualization Format (OVF) packages in content library, as well as methods to create library items in content library from virtual machines and virtual appliances.

To deploy a virtual machine or a virtual appliance from a library item:

1. Create a class Com::Vmware::Vcenter::Ovf::LibraryItem::DeploymentTarget to specify the target deployment type and target deployment designation.
2. Create a class Com::Vmware::Vcenter::Ovf::LibraryItem::ResourcePoolDeploymentSpec to specify the parameters for the target deployment.
3. Use the `deploy` method with the created target and parameter specifications, along with the identifier of the specified source content library item. See :func:`Com::Vmware::Vcenter::Ovf::LibraryItem.deploy` .

To create a library item in content library from a virtual machine or virtual appliance:

1. Create a class Com::Vmware::Vcenter::Ovf::LibraryItem::DeployableIdentity to specify the source virtual machine or virtual appliance to be used as the OVF template source.
2. Create a class Com::Vmware::Vcenter::Ovf::LibraryItem::CreateTarget to specify the target library and library item.
3. Create a class Com::Vmware::Vcenter::Ovf::LibraryItem::CreateSpec to specify the settings for the OVF package to be created.
4. Use the `create` method with the created target and parameter specifications, along with the specified source entity. See :func:`Com::Vmware::Vcenter::Ovf::LibraryItem.create` .

Constant Array of String::DEPLOYABLE # The types of resources that can be created by deploying an OVF package and can be captured to create a library item using the `Com::Vmware::Vcenter::Ovf::LibraryItem` interface* .

## Member Function Documentation

public method Com::Vmware::Vcenter::Ovf::LibraryItem::create | ( |  | ) |

Creates a library item in content library from a virtual machine or virtual appliance.

This method creates a library item in content library whose content is an OVF package derived from a source virtual machine or virtual appliance, using the supplied create specification. The OVF package may be stored as in a newly created library item or in an in an existing library item. For an existing library item whose content is updated by this method* , the original content is overwritten.

Parameters

  client_token | [OPTIONAL] Client-generated token used to retry a request if the client fails to get a response from the server. If the original request succeeded, the result of that request will be returned, otherwise the operation will be retried. If null , the server will create a token. . The value must be String or None.
  source | [REQUIRED] Identifier of the virtual machine or virtual appliance to use as the source. . The value must be Com::Vmware::Vcenter::Ovf::LibraryItem::DeployableIdentity.
  target | [REQUIRED] Specification of the target content library and library item. . The value must be Com::Vmware::Vcenter::Ovf::LibraryItem::CreateTarget.
  create_spec | [REQUIRED] Information used to create the OVF package from the source virtual machine or virtual appliance. . The value must be Com::Vmware::Vcenter::Ovf::LibraryItem::CreateSpec.

Return values

  Information | about the success or failure of the method , along with the details of the result or failure. The return type will be Com::Vmware::Vcenter::Ovf::LibraryItem::CreateResult

Exceptions

  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if `create_spec` contains invalid arguments.
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if `source` describes an unexpected resource type.
  Com::Vmware::Vapi::Std::Errors::NotFound | if the virtual machine or virtual appliance specified by `source` does not exist.
  Com::Vmware::Vapi::Std::Errors::NotFound | if the library or library item specified by `target` does not exist.
  Com::Vmware::Vapi::Std::Errors::NotAllowedInCurrentState | if the operation cannot be performed because of the specified virtual machine or virtual appliance's current state. For example, if the virtual machine configuration information is not available, or if the virtual appliance is running.
  Com::Vmware::Vapi::Std::Errors::ResourceInaccessible | if there was an error accessing a file from the source virtual machine or virtual appliance.
  Com::Vmware::Vapi::Std::Errors::ResourceBusy | if the specified virtual machine or virtual appliance is busy.

Code:
click to view
# Number of lines of code in create: 13
sub create {
my ($self, %args) = @_;
my $client_token = $args {client_token};
my $source = $args {source};
my $target = $args {target};
my $create_spec = $args {create_spec};
$self->validate_args (method_name => 'create',
method_args => \%args);
return $self->invoke (method_name => 'create',
method_args => \%args);
}

public method Com::Vmware::Vcenter::Ovf::LibraryItem::deploy | ( |  | ) |

Deploys an OVF package stored in content library to a newly created virtual machine or virtual appliance.

This method deploys an OVF package which is stored in the library item specified by `ovf_library_item_id` . It uses the deployment specification in `deployment_spec` to deploy the OVF package to the location specified by `target` .

Parameters

  client_token | [OPTIONAL] Client-generated token used to retry a request if the client fails to get a response from the server. If the original request succeeded, the result of that request will be returned, otherwise the operation will be retried. If null , the server will create a token. . The value must be String or None.
  ovf_library_item_id | [REQUIRED] Identifier of the content library item containing the OVF package to be deployed. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). . The value must be str.
  target | [REQUIRED] Specification of the deployment target. . The value must be Com::Vmware::Vcenter::Ovf::LibraryItem::DeploymentTarget.
  deployment_spec | [REQUIRED] Specification of how the OVF package should be deployed to the target. . The value must be Com::Vmware::Vcenter::Ovf::LibraryItem::ResourcePoolDeploymentSpec.

Return values

  Information | about the success or failure of the method , along with the details of the result or failure. The return type will be Com::Vmware::Vcenter::Ovf::LibraryItem::DeploymentResult

Exceptions

  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if `target` contains invalid arguments.
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if `deployment_spec` contains invalid arguments or has fields that are inconsistent with `target` .
  Com::Vmware::Vapi::Std::Errors::NotFound | if the library item specified by `ovf_library_item_id` does not exist.
  Com::Vmware::Vapi::Std::Errors::NotFound | if any resource specified by a field of the class Com::Vmware::Vcenter::Ovf::LibraryItem::DeploymentTarget class , specified by `target` , does not exist.
  Com::Vmware::Vapi::Std::Errors::ResourceInaccessible | if there was an error accessing the OVF package stored in the library item specified by `ovf_library_item_id` .
  Com::Vmware::Vapi::Std::Errors::Unauthorized | if you do not have all of the privileges described as follows : Method execution requires VirtualMachine.Config.AddNewDisk if the OVF descriptor has a disk drive (type 17) section. Method execution requires VirtualMachine.Config.AdvancedConfig if the OVF descriptor has an ExtraConfig section. Method execution requires Extension.Register for specified resource group if the OVF descriptor has a vServiceDependency section. Method execution requires Network.Assign for target network if specified. Method execution requires Datastore.AllocateSpace for target datastore if specified.

Code:
click to view
# Number of lines of code in deploy: 13
sub deploy {
my ($self, %args) = @_;
my $client_token = $args {client_token};
my $ovf_library_item_id = $args {ovf_library_item_id};
my $target = $args {target};
my $deployment_spec = $args {deployment_spec};
$self->validate_args (method_name => 'deploy',
method_args => \%args);
return $self->invoke (method_name => 'deploy',
method_args => \%args);
}

public method Com::Vmware::Vcenter::Ovf::LibraryItem::filter | ( |  | ) |

Queries an OVF package stored in content library to retrieve information to use when deploying the package. See :func:`Com::Vmware::Vcenter::Ovf::LibraryItem.deploy` .

This method retrieves information from the descriptor of the OVF package stored in the library item specified by `ovf_library_item_id` . The information returned by the method* can be used to populate the deployment specification (see class Com::Vmware::Vcenter::Ovf::LibraryItem::ResourcePoolDeploymentSpec when deploying the OVF package to the deployment target specified by `target` .

Parameters

  ovf_library_item_id | [REQUIRED] Identifier of the content library item containing the OVF package to query. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). . The value must be str.
  target | [REQUIRED] Specification of the deployment target. . The value must be Com::Vmware::Vcenter::Ovf::LibraryItem::DeploymentTarget.

Return values

  Information | that can be used to populate the deployment specification (see class Com::Vmware::Vcenter::Ovf::LibraryItem::ResourcePoolDeploymentSpec ) when deploying the OVF package to the deployment target specified by `target` . The return type will be Com::Vmware::Vcenter::Ovf::LibraryItem::OvfSummary

Exceptions

  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if `target` contains invalid arguments.
  Com::Vmware::Vapi::Std::Errors::NotFound | if the library item specified by `ovf_library_item_id` does not exist.
  Com::Vmware::Vapi::Std::Errors::NotFound | if any resource specified by a field of the class Com::Vmware::Vcenter::Ovf::LibraryItem::DeploymentTarget class , specified by `target` , does not exist.
  Com::Vmware::Vapi::Std::Errors::ResourceInaccessible | if there was an error accessing the OVF package at the specified `ovf_library_item_id` .

Code:
click to view
# Number of lines of code in filter: 11
sub filter {
my ($self, %args) = @_;
my $ovf_library_item_id = $args {ovf_library_item_id};
my $target = $args {target};
$self->validate_args (method_name => 'filter',
method_args => \%args);
return $self->invoke (method_name => 'filter',
method_args => \%args);
}

public method Com::Vmware::Vcenter::Ovf::LibraryItem::new | ( |  | ) |

Constructor to initialize the object

Parameters

  api_provider | - protocol connection to use with stubs created by this factory
  StubConfig | - Stub's additional configuration

Return values

  Blessed | object

Code:
click to view
# Number of lines of code in new: 11
sub new {
my ($class, %args) = @_;
$class = ref($class) || $class;
my $stub_config = $args {stub_config};
my $api_provider = $args {api_provider};
my $self = $class->SUPER::new('stub_config' => $stub_config,
'api_provider' => $api_provider);
bless $self, $class;
return $self;
}

The documentation for this class was generated from the following file:

- Com/Vmware/Vcenter/Ovf/LibraryItem.pm