com.vmware.content.library.item package

Submodules

com.vmware.content.library.item.downloadsession_client module

The Content Library Item Download Session module provides classes and classes for downloading files in a session.

class com.vmware.content.library.item.downloadsession_client.File(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The File class provides methods for accessing files within a download session.

After a download session is created against a library item, the File class can be used to retrieve all downloadable content within the library item. Since the content may not be available immediately in a downloadable form on the server side, the client will have to prepare the file and wait for the file status to become File.PrepareStatus.PREPARED.

class EndpointType(string)

Bases: vmware.vapi.bindings.enum.Enum

The File.EndpointType class defines the types of endpoints used to download the file.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

DIRECT = EndpointType(string='DIRECT')

A direct download endpoint indicating the location of the file on storage. The caller is responsible for retrieving the file from the storage location directly.

HTTPS = EndpointType(string='HTTPS')

An https download endpoint.

class Info(name=None, size=None, bytes_transferred=None, status=None, download_endpoint=None, checksum_info=None, error_message=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The File.Info class defines the downloaded file.

Tip

The arguments are used to initialize data attributes with the same names.

class PrepareStatus(string)

Bases: vmware.vapi.bindings.enum.Enum

The File.PrepareStatus class defines the state of the file in preparation for download.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

ERROR = PrepareStatus(string='ERROR')

Prepare failed.

PREPARED = PrepareStatus(string='PREPARED')

Prepare succeeded. The file is ready for download.

PREPARE_REQUESTED = PrepareStatus(string='PREPARE_REQUESTED')

A prepare has been requested, however the server hasn’t started the preparation yet.

PREPARING = PrepareStatus(string='PREPARING')

A prepare has been requested and the file is in the process of being prepared.

UNPREPARED = PrepareStatus(string='UNPREPARED')

The file hasn’t been requested for preparation.

get(download_session_id, file_name)

Retrieves file download information for a specific file.

Parameters:
  • download_session_id (str) – Identifier of the download session. The parameter must be an identifier for the resource type: com.vmware.content.library.item.DownloadSession.
  • file_name (str) – Name of the file requested.
Return type:

File.Info

Returns:

The File.Info instance containing the status of the file and its download link if available.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the download session associated with download_session_id does not exist.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument if there is no file with the specified file_name.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource com.vmware.content.library.Item referenced by the parameter libraryItemId requires System.Read.
list(download_session_id)

Lists the information of all the files in the library item associated with the download session.

Parameters:

download_session_id (str) – Identifier of the download session. The parameter must be an identifier for the resource type: com.vmware.content.library.item.DownloadSession.

Return type:

list of File.Info

Returns:

The list of File.Info instances.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the download session associated with download_session_id doesn’t exist.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource com.vmware.content.library.Item referenced by the parameter libraryItemId requires System.Read.
prepare(download_session_id, file_name, endpoint_type=None)

Requests a file to be prepared for download.

Parameters:
  • download_session_id (str) – Identifier of the download session. The parameter must be an identifier for the resource type: com.vmware.content.library.item.DownloadSession.
  • file_name (str) – Name of the file requested for download.
  • endpoint_type (File.EndpointType or None) – Endpoint type request, one of HTTPS, DIRECT. This will determine the type of the File.Info.download_endpoint that is generated when the file is prepared. The File.EndpointType.DIRECT is only available to users who have the ContentLibrary.ReadStorage privilege. If not specified the default is File.EndpointType.HTTPS.
Return type:

File.Info

Returns:

File information containing the status of the request and the download link to the file.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the download session does not exist.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument if there is no file with the specified file_name.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized if the the download session wasn’t created with the ContentLibrary.ReadStorage privilege and the caller requested a File.EndpointType.DIRECT endpoint type.

class com.vmware.content.library.item.downloadsession_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

com.vmware.content.library.item.updatesession_client module

The Content Library Item Update Session module provides classes and classes for updating files in a session.

class com.vmware.content.library.item.updatesession_client.File(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The File class provides methods for accessing files within an update session.

After an update session is created against a library item, the File class 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 com.vmware.content.library.item_client.UpdateSession.

class AddSpec(name=None, source_type=None, source_endpoint=None, size=None, checksum_info=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The File.AddSpec class describes the properties of the file to be uploaded.

Tip

The arguments are used to initialize data attributes with the same names.

class Info(name=None, source_type=None, size=None, checksum_info=None, source_endpoint=None, upload_endpoint=None, bytes_transferred=None, status=None, error_message=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The File.Info class defines the uploaded file.

Tip

The arguments are used to initialize data attributes with the same names.

class SourceType(string)

Bases: vmware.vapi.bindings.enum.Enum

The File.SourceType class defines how the file content is retrieved.

Note

This class represents an enumerated type in the interface language definition. The class contains class attributes which represent the values in the current version of the enumerated type. Newer versions of the enumerated type may contain new values. To use new values of the enumerated type in communication with a server that supports the newer version of the API, you instantiate this class. See enumerated type description page.

NONE = SourceType(string='NONE')

No source type has been requested.

PULL = SourceType(string='PULL')

The server is pulling content from a URL. The URL scheme can be http, https, file, or ds.

PUSH = SourceType(string='PUSH')

The client is uploading content using HTTP(S) PUT requests.

class ValidationError(name=None, error_message=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The File.ValidationError class defines the validation error of a file in the session.

Tip

The arguments are used to initialize data attributes with the same names.

class ValidationResult(has_errors=None, missing_files=None, invalid_files=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The File.ValidationResult class defines the result of validating the files in the session.

Tip

The arguments are used to initialize data attributes with the same names.

add(update_session_id, file_spec)

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 (str) – Identifier of the update session to be modified. The parameter must be an identifier for the resource type: com.vmware.content.library.item.UpdateSession.
  • file_spec (File.AddSpec) – 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.
Return type:

File.Info

Returns:

An File.Info class containing upload links as well as server side state tracking the transfer of the file.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument if the file_spec is invalid.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the update session doesn’t exist.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized if the caller doesn’t have ContentLibrary.ReadStorage privilege on the library item of the update session and source type File.SourceType.PULL is requested for a file or datastore source endpoint (that is, not HTTP or HTTPs based endpoint).

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the content of the library item associated with the update session has been deleted from the storage backings (see null) associated with it.

get(update_session_id, file_name)

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 (str) – Identifier of the update session. The parameter must be an identifier for the resource type: com.vmware.content.library.item.UpdateSession.
  • file_name (str) – Name of the file.
Return type:

File.Info

Returns:

Information about the file.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the update session doesn’t exist.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument if the file doesn’t exist in the library item associated with the update session.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource com.vmware.content.library.Item referenced by the parameter libraryItemId requires System.Read.
list(update_session_id)

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

Parameters:

update_session_id (str) – Identifier of the update session. The parameter must be an identifier for the resource type: com.vmware.content.library.item.UpdateSession.

Return type:

list of File.Info

Returns:

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).

Raise:

com.vmware.vapi.std.errors_client.NotFound if the update session doesn’t exist.

Raise:

com.vmware.vapi.std.errors_client.Unauthorized if you do not have all of the privileges described as follows:

  • The resource com.vmware.content.library.Item referenced by the parameter libraryItemId requires System.Read.
remove(update_session_id, file_name)

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

Parameters:
  • update_session_id (str) – Identifier of the update session. The parameter must be an identifier for the resource type: com.vmware.content.library.item.UpdateSession.
  • file_name (str) – Name of the file to be removed.
Raise:

com.vmware.vapi.std.errors_client.NotFound if the update session doesn’t exist.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument if the file doesn’t exist in the library item associated with the update session.

validate(update_session_id)

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 File.ValidationResult.missing_files set. The user can add the missing files and try re-validating. For other type of errors, File.ValidationResult.invalid_files will contain the list of invalid files.

Parameters:update_session_id (str) – Identifier of the update session to validate. The parameter must be an identifier for the resource type: com.vmware.content.library.item.UpdateSession.
Return type:File.ValidationResult
Returns:A validation result containing missing files or invalid files and the reason why they are invalid.
Raise:com.vmware.vapi.std.errors_client.NotFound if no update session with the given identifier exists.
Raise:com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the update session is not in the com.vmware.content.library.item_client.UpdateSessionModel.State.ACTIVE state, or if some of the files that will be uploaded by the client aren’t received correctly.
class com.vmware.content.library.item.updatesession_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase