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::Content::Library::Item Class Reference
Inheritance diagram for Com::Vmware::Content::Library::Item:

## Classes
class | FindSpec

## Avaliable Methods
public method | create ()
public method | find ()
public method | copy ()
public method | delete ()
public method | get ()
public method | new ()
public method | update ()
public method | list ()

## Detailed Description

The `Com::Vmware::Content::Library::Item` interface provides methods for managing library items. Constant String::RESOURCE_TYPE # Resource type for item.

## Member Function Documentation

public method Com::Vmware::Content::Library::Item::copy | ( |  | ) |

Copies a library item.

Copying a library item allows a duplicate to be made within the same or different library. The copy occurs by first creating a new library item, whose identifier is returned. The content of the library item is then copied asynchronously. This copy can be tracked as a task.

If the copy fails, Content Library Service will roll back the copy by deleting any content that was already copied, and removing the new library item. A failure during rollback may require manual cleanup by an administrator.

A library item cannot be copied into a subscribed library.

Parameters

  client_token | [OPTIONAL] A unique token generated on the client for each copy request. The token should be a universally unique identifier (UUID), for example: `b8a2a2e3-2314-43cd-a871-6ede0f429751` . This token can be used to guarantee idempotent copy. If not specified copy is not idempotent. . The value must be String or None.
  source_library_item_id | [REQUIRED] Identifier of the existing library item from which the content will be copied. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). . The value must be str.
  destination_create_spec | [REQUIRED] Specification for the new library item to be created. . The value must be Com::Vmware::Content::Library::ItemModel.

Return values

  The | identifier of the new library item into which the content is being copied. The value will be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). The return type will be str

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the library item with `source_library_item_id` does not exist, or if the library referenced by the :attr:`Com::Vmware::Content::Library::ItemModel.library_id` property of `destination_create_spec` does not exist.
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if one of the following is true for the new library item: name is empty name exceeds 80 characters description exceeds 1024 characters
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if the `client_token` does not conform to the UUID format.
  Com::Vmware::Vapi::Std::Errors::InvalidElementType | if the :attr:`Com::Vmware::Content::Library::ItemModel.library_id` property of `destination_create_spec` refers to a subscribed library.
  Com::Vmware::Vapi::Std::Errors::ResourceInaccessible | if the copy operation failed because the source or destination library item is not accessible.

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

public method Com::Vmware::Content::Library::Item::create | ( |  | ) |

Creates a new library item.

A new library item is created without any content. After creation, content can be added through the class Com::Vmware::Content::Library::Item::UpdateSession and class Com::Vmware::Content::Library::Item::Updatesession::File interfaces .

A library item cannot be created in a subscribed library.

Parameters

  client_token | [OPTIONAL] A unique token generated on the client for each creation request. The token should be a universally unique identifier (UUID), for example: `b8a2a2e3-2314-43cd-a871-6ede0f429751` . This token can be used to guarantee idempotent creation. If not specified creation is not idempotent. . The value must be String or None.
  create_spec | [REQUIRED] Specification that defines the properties of the new library item. . The value must be Com::Vmware::Content::Library::ItemModel.

Return values

  Identifier | of the new library item. The value will be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). The return type will be str

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the :attr:`Com::Vmware::Content::Library::ItemModel.library_id` property of `create_spec` refers to a library that does not exist.
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if one of the following is true for the new library item: name is empty name exceeds 80 characters description exceeds 1024 characters
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if the `client_token` does not conform to the UUID format.
  Com::Vmware::Vapi::Std::Errors::InvalidElementType | if the :attr:`Com::Vmware::Content::Library::ItemModel.library_id` property of `destinationCreateSpec` refers to a subscribed library.

Code:
click to view
# Number of lines of code in create: 11
sub create {
my ($self, %args) = @_;
my $client_token = $args {client_token};
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::Content::Library::Item::delete | ( |  | ) |

Deletes a library item.

This method will immediately remove the item from the library that owns it. The content of the item will be asynchronously removed from the storage backings. The content deletion can be tracked with a task. In the event that the task fails, an administrator may need to manually remove the files from the storage backing.

This method cannot be used to delete a library item that is a member of a subscribed library. Removing an item from a subscribed library requires deleting the item from the original published local library and syncing the subscribed library.

Parameters

  library_item_id | [REQUIRED] Identifier of the library item to delete. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). . The value must be str.

Exceptions

  Com::Vmware::Vapi::Std::Errors::InvalidElementType | if the library item with the given `library_item_id` is a member of a subscribed library.
  Com::Vmware::Vapi::Std::Errors::NotFound | if the library item with the specified `library_item_id` does not exist.

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

public method Com::Vmware::Content::Library::Item::find | ( |  | ) |

Returns identifiers of all the visible (as determined by authorization policy) library items matching the requested class Com::Vmware::Content::Library::Item::FindSpec .

Parameters

  spec | [REQUIRED] Specification describing what properties to filter on. . The value must be Com::Vmware::Content::Library::Item::FindSpec.

Return values

  The | list of identifiers of all the visible library items matching the given `spec` . The value will be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). The return type will be Array of str

Exceptions

  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if no properties are specified in the `spec` .

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

public method Com::Vmware::Content::Library::Item::get | ( |  | ) |

Returns the class Com::Vmware::Content::Library::ItemModel with the given identifier.

Parameters

  library_item_id | [REQUIRED] Identifier of the library item to return. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). . The value must be str.

Return values

  The | class Com::Vmware::Content::Library::ItemModel instance with the given `library_item_id` . The return type will be Com::Vmware::Content::Library::ItemModel

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if no item with the given `library_item_id` exists.

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

public method Com::Vmware::Content::Library::Item::list | ( |  | ) |

Returns the identifiers of all items in the given library.

Parameters

  library_id | [REQUIRED] Identifier of the library whose items should be returned. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.Library). . The value must be str.

Return values

  The | list of identifiers of the items in the library specified by `library_id` . The value will be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). The return type will be Array of str

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the library associated with `library_id` does not exist.

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

public method Com::Vmware::Content::Library::Item::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;
}

public method Com::Vmware::Content::Library::Item::update | ( |  | ) |

Updates the specified properties of a library item.

This is an incremental update to the library item. Fields that are null in the update specification are left unchanged.

This method cannot update a library item that is a member of a subscribed library. Those items must be updated in the source published library and synchronized to the subscribed library.

Parameters

  library_item_id | [REQUIRED] Identifier of the library item to update. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.Item). . The value must be str.
  update_spec | [REQUIRED] Specification of the properties to set. . The value must be Com::Vmware::Content::Library::ItemModel.

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the library item specified by `library_item_id` does not exist.
  Com::Vmware::Vapi::Std::Errors::InvalidElementType | if the library item corresponding to `library_item_id` is a member of a subscribed library.
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if one of the following is true for the `update_spec` : name is empty name exceeds 80 characters description exceeds 1024 characters version is not equal to the current version of the library item

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

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

- Com/Vmware/Content/Library/Item.pm