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

## Classes
class | AddSpec
class | Info
class | SourceType
class | ValidationError
class | ValidationResult

## Avaliable Methods
public method | remove ()
public method | add ()
public method | get ()
public method | new ()
public method | list ()
public method | validate ()

## Detailed Description

The `Com::Vmware::Content::Library::Item::Updatesession::File` interface provides methods for accessing files within an update session.

After an update session is created against a library item, the `Com::Vmware::Content::Library::Item::Updatesession::File` interface can be used to make changes to the underlying library item metadata as well as the content of the files. The following changes can be made:

- deleting an existing file within the library item. This deletes both the metadata and the content.
- updating an existing file with new content.
- adding a new file to the library item.

The above changes are not applied or visible until the session is completed. See class Com::Vmware::Content::Library::Item::UpdateSession .

## Member Function Documentation

public method Com::Vmware::Content::Library::Item::Updatesession::File::add | ( |  | ) |

Requests file content to be changed (either created, or updated). Depending on the source type of the file, this method will either return an upload endpoint where the client can push the content, or the server will pull from the provided source endpoint. If a file with the same name already exists in this session, this method will be used to update the content of the existing file.

When importing a file directly from storage, where the source endpoint is a file or datastore URI, you will need to have the ContentLibrary.ReadStorage privilege on the library item. If the file is located in the same directory as the library storage backing folder, the server will move the file instead of copying it, thereby allowing instantaneous import of files for efficient backup and restore scenarios. In all other cases, a copy is performed rather than a move.

Parameters

  update_session_id | [REQUIRED] Identifier of the update session to be modified. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.item.UpdateSession). . The value must be str.
  file_spec | [REQUIRED] Specification for the file that needs to be added or updated. This includes whether the client wants to push the content or have the server pull it. . The value must be Com::Vmware::Content::Library::Item::Updatesession::File::AddSpec.

Return values

  An | class Com::Vmware::Content::Library::Item::Updatesession::File::Info class containing upload links as well as server side state tracking the transfer of the file. The return type will be Com::Vmware::Content::Library::Item::Updatesession::File::Info

Exceptions

  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if the `file_spec` is invalid.
  Com::Vmware::Vapi::Std::Errors::NotFound | if the update session doesn't exist.
  Com::Vmware::Vapi::Std::Errors::Unauthorized | if the caller doesn't have ContentLibrary.ReadStorage privilege on the library item of the update session and source type :attr:`Com::Vmware::Content::Library::Item::Updatesession::File::SourceType.PULL` is requested for a file or datastore source endpoint (that is, not HTTP or HTTPs based endpoint).

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

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

Retrieves information about a specific file in the snapshot of the library item at the time when the update session was created.

Parameters

  update_session_id | [REQUIRED] Identifier of the update session. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.item.UpdateSession). . The value must be str.
  file_name | [REQUIRED] Name of the file. . The value must be String.

Return values

  Information | about the file. The return type will be Com::Vmware::Content::Library::Item::Updatesession::File::Info

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the update session doesn't exist.
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if the file doesn't exist in the library item associated with the update session.

Code:
click to view
# Number of lines of code in get: 11
sub get {
my ($self, %args) = @_;
my $update_session_id = $args {update_session_id};
my $file_name = $args {file_name};
$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::Updatesession::File::list | ( |  | ) |

Lists all files in the library item associated with the update session.

Parameters

  update_session_id | [REQUIRED] Identifier of the update session. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.item.UpdateSession). . The value must be str.

Return values

  The | list of the files in the library item associated with the update session. This list* may be empty if the caller has removed all the files as part of this session (in which case completing the update session will result in an empty library item). The return type will be Array of Com::Vmware::Content::Library::Item::Updatesession::File::Info

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the update session doesn't exist.

Code:
click to view
# Number of lines of code in list: 10
sub list {
my ($self, %args) = @_;
my $update_session_id = $args {update_session_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::Updatesession::File::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::Updatesession::File::remove | ( |  | ) |

Requests a file to be removed. The file will only be effectively removed when the update session is completed.

Parameters

  update_session_id | [REQUIRED] Identifier of the update session. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.item.UpdateSession). . The value must be str.
  file_name | [REQUIRED] Name of the file to be removed. . The value must be String.

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if the update session doesn't exist.
  Com::Vmware::Vapi::Std::Errors::InvalidArgument | if the file doesn't exist in the library item associated with the update session.

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

public method Com::Vmware::Content::Library::Item::Updatesession::File::validate | ( |  | ) |

Validates the files in the update session with the referenced identifier and ensures all necessary files are received. In the case where a file is missing, this method will return its name in the :attr:`Com::Vmware::Content::Library::Item::Updatesession::File::ValidationResult.missing_files` set. The user can add the missing files and try re-validating. For other type of errors, :attr:`Com::Vmware::Content::Library::Item::Updatesession::File::ValidationResult.invalid_files` will contain the list of invalid files.

Parameters

  update_session_id | [REQUIRED] Identifier of the update session to validate. The value must be an identifier for the resource type getQualifiedName(com.vmware.content.library.item.UpdateSession). . The value must be str.

Return values

  A | validation result containing missing files or invalid files and the reason why they are invalid. The return type will be Com::Vmware::Content::Library::Item::Updatesession::File::ValidationResult

Exceptions

  Com::Vmware::Vapi::Std::Errors::NotFound | if no update session with the given identifier exists.
  Com::Vmware::Vapi::Std::Errors::NotAllowedInCurrentState | if the update session is not in the :attr:`Com::Vmware::Content::Library::Item::UpdateSessionModel::State.ACTIVE` state, or if some of the files that will be uploaded by the client aren't received correctly.

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

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

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