com.vmware.content.library package

Submodules

com.vmware.content.library.item_client module

The Content Library Item module provides classes and classes for managing files in a library item.

class com.vmware.content.library.item_client.DownloadSession(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The DownloadSession class manipulates download sessions, which are used to download content from the Content Library Service.

A download session is an object that tracks the download of content (that is, downloading content from the Content Library Service) and acts as a lease to keep the download links available.

The com.vmware.content.library.item.downloadsession_client.File class provides access to the download links.

RESOURCE_TYPE = 'com.vmware.content.library.item.DownloadSession'

Resource type for a download session.

cancel(download_session_id)

Cancels the download session. This method will abort any ongoing transfers and invalidate transfer urls that the client may be downloading from.

Parameters:

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

Raise:

com.vmware.vapi.std.errors_client.NotFound if no download session with the given identifier exists.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the download session is not in the DownloadSessionModel.State.ACTIVE state.

Raise:

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

  • Method execution requires System.Anonymous.
create(create_spec, client_token=None)

Creates a new download session.

Parameters:
  • client_token (str or None) – A unique token generated by 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.
  • create_spec (DownloadSessionModel) – Specification for the new download session to be created.
Return type:

str

Returns:

Identifier of the new download session being created. The return value will be an identifier for the resource type: com.vmware.content.library.item.DownloadSession.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument if the session specification is not valid.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument format.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the library item targeted by the download does not 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 attribute DownloadSessionModel.library_item_id requires ContentLibrary.DownloadSession.
delete(download_session_id)

Deletes a download session. This removes the session and all information associated with it.

Removing a download session leaves any current transfers for that session in an indeterminate state (there is no guarantee that the transfers will be able to complete). However there will no longer be a means of inspecting the status of those downloads except by seeing the effect on the library item.

Download sessions for which there is no download activity or which are complete will automatically be expired and then deleted after a period of time.

Parameters:

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

Raise:

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

Raise:

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

  • Method execution requires System.Anonymous.
fail(download_session_id, client_error_message)

Terminates the download session with a client specified error message.

This is useful in transmitting client side failures (for example, not being able to download a file) to the server side.

Parameters:
  • download_session_id (str) – Identifier of the download session to fail. The parameter must be an identifier for the resource type: com.vmware.content.library.item.DownloadSession.
  • client_error_message (str) – Client side error message. This can be useful in providing some extra details about the client side failure. Note that the message won’t be translated to the user’s locale.
Raise:

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

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the download session is not in the DownloadSessionModel.State.ACTIVE state.

Raise:

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

  • Method execution requires System.Anonymous.
get(download_session_id)

Gets the download session with the specified identifier, including the most up-to-date status information for the session.

Parameters:

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

Return type:

DownloadSessionModel

Returns:

The DownloadSessionModel instance with the given download_session_id.

Raise:

com.vmware.vapi.std.errors_client.NotFound if no download session with the given download_session_id exists.

Raise:

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

  • Method execution requires System.Anonymous.
keep_alive(download_session_id, progress=None)

Keeps a download session alive. This operation is allowed only if the session is in the DownloadSessionModel.State.ACTIVE state.

If there is no activity for a download session for a certain period of time, the download session will expire. The download session expiration timeout is configurable in the Content Library Service system configuration. The default is five minutes. Invoking this method enables a client to specifically extend the lifetime of an active download session.

Parameters:
  • download_session_id (str) – Identifier of the download session whose lifetime should be extended. The parameter must be an identifier for the resource type: com.vmware.content.library.item.DownloadSession.
  • progress (long or None) – Optional update to the progress property of the session. If specified, the new progress should be greater then the current progress. See DownloadSessionModel.client_progress. If not specified the progress is not updated.
Raise:

com.vmware.vapi.std.errors_client.NotFound if no download session with the given identifier exists.

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the download session is not in the DownloadSessionModel.State.ACTIVE state.

Raise:

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

  • Method execution requires System.Anonymous.
list(library_item_id=None)

Lists the identifiers of the download sessions created by the calling user. Optionally may filter by library item.

Parameters:

library_item_id (str or None) – Library item identifier on which to filter results. The parameter must be an identifier for the resource type: com.vmware.content.library.item.DownloadSession. If not specified all download session identifiers are listed.

Return type:

list of str

Returns:

The list of identifiers of all download sessions created by the calling user. The return value will contain identifiers for the resource type: com.vmware.content.library.item.DownloadSession.

Raise:

com.vmware.vapi.std.errors_client.NotFound if a library item identifier is given for an item which does not 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.DownloadSession referenced by the parameter library_item_id requires ContentLibrary.DownloadSession.
class com.vmware.content.library.item_client.DownloadSessionModel(id=None, library_item_id=None, library_item_content_version=None, error_message=None, client_progress=None, state=None, expiration_time=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The DownloadSessionModel class provides information on an active DownloadSession resource.

Tip

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

class State(string)

Bases: vmware.vapi.bindings.enum.Enum

The state of the download session.

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.

ACTIVE = State(string='ACTIVE')

The session is active. Individual files may be in the process of being transferred and may become ready for download at different times.

CANCELED = State(string='CANCELED')

The session has been canceled. On-going downloads may fail. The session will stay in this state until it is either deleted by the user or automatically cleaned up by the Content Library Service.

ERROR = State(string='ERROR')

Indicates there was an error during the session lifecycle.

class com.vmware.content.library.item_client.File(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The File class can be used to query for information on the files within a library item. Files are objects which are added to a library item through the UpdateSession and com.vmware.content.library.item.updatesession_client.File classes.

class ChecksumAlgorithm(string)

Bases: vmware.vapi.bindings.enum.Enum

The File.ChecksumAlgorithm class defines the valid checksum algorithms.

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.

MD5 = ChecksumAlgorithm(string='MD5')

Checksum algorithm: MD5

SHA1 = ChecksumAlgorithm(string='SHA1')

Checksum algorithm: SHA-1

class ChecksumInfo(algorithm=None, checksum=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

Provides checksums for a File.Info object.

Tip

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

class Info(checksum_info=None, name=None, size=None, cached=None, version=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The File.Info class provides information about a file in Content Library Service storage.

A file is an actual stored object for a library item. An item will have zero files initially, but one or more can be uploaded to the item.

Tip

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

get(library_item_id, name)

Retrieves the information for a single file in a library item by its name.

Parameters:
  • library_item_id (str) – Identifier of the library item whose file information should be returned. The parameter must be an identifier for the resource type: com.vmware.content.library.Item.
  • name (str) – Name of the file in the library item whose information should be returned.
Return type:

File.Info

Returns:

The File.Info object with information on the specified file.

Raise:

com.vmware.vapi.std.errors_client.NotFound if library_item_id refers to a library item that does not exist.

Raise:

com.vmware.vapi.std.errors_client.NotFound if name refers to a file that does not exist in the library item.

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 library_item_id requires System.Read.
list(library_item_id)

Lists all of the files that are stored within a given library item.

Parameters:

library_item_id (str) – Identifier of the library item whose files should be listed. The parameter must be an identifier for the resource type: com.vmware.content.library.Item.

Return type:

list of File.Info

Returns:

The list of all of the files that are stored within the given library item.

Raise:

com.vmware.vapi.std.errors_client.NotFound if library_item_id refers to a library item that does not 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 library_item_id requires System.Read.
class com.vmware.content.library.item_client.Storage(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

Storage is a resource that represents a specific instance of a file stored on a storage backing. Unlike File, which is abstract, storage represents concrete files on the various storage backings. A file is only represented once in File, but will be represented multiple times (once for each storage backing) in Storage. The Storage class provides information on the storage backing and the specific location of the file in that backing to privileged users who want direct access to the file on the storage medium.

class Info(storage_backing=None, storage_uris=None, checksum_info=None, name=None, size=None, cached=None, version=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The Storage.Info class is the expanded form of File.Info that includes details about the storage backing for a file in a library item.

Tip

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

get(library_item_id, file_name)

Retrieves the storage information for a specific file in a library item.

Parameters:
  • library_item_id (str) – Identifier of the library item whose storage information should be retrieved. The parameter must be an identifier for the resource type: com.vmware.content.library.Item.
  • file_name (str) – Name of the file for which the storage information should be listed.
Return type:

list of Storage.Info

Returns:

The list of all the storage items for the given file within the given library item.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the specified library item does not exist.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the specified file does not exist in the given library item.

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 library_item_id requires ContentLibrary.ReadStorage.
list(library_item_id)

Lists all storage items for a given library item.

Parameters:

library_item_id (str) – Identifier of the library item whose storage information should be listed. The parameter must be an identifier for the resource type: com.vmware.content.library.Item.

Return type:

list of Storage.Info

Returns:

The list of all storage items for a given library item.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the specified library item does not 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 library_item_id requires ContentLibrary.ReadStorage.
class com.vmware.content.library.item_client.StubFactory(stub_config)

Bases: vmware.vapi.bindings.stub.StubFactoryBase

class com.vmware.content.library.item_client.TransferEndpoint(uri=None, ssl_certificate_thumbprint=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The TransferEndpoint class encapsulates a URI along with extra information about it.

Tip

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

class com.vmware.content.library.item_client.TransferStatus(string)

Bases: vmware.vapi.bindings.enum.Enum

The TransferStatus class defines the transfer state of a 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.

ERROR = TransferStatus(string='ERROR')

Indicates that there was an error transferring or validating the file.

READY = TransferStatus(string='READY')

Indicates that the file has been fully transferred and is ready to be used.

TRANSFERRING = TransferStatus(string='TRANSFERRING')

Indicates that data is being transferred to the file.

VALIDATING = TransferStatus(string='VALIDATING')

Indicates that the file is being validated (checksum, type adapters).

WAITING_FOR_TRANSFER = TransferStatus(string='WAITING_FOR_TRANSFER')

Indicates that a file has been defined for a library item and its content needs to be uploaded.

class com.vmware.content.library.item_client.UpdateSession(config)

Bases: vmware.vapi.bindings.stub.VapiInterface

The UpdateSession class manipulates sessions that are used to upload content into the Content Library Service, and/or to remove files from a library item.

An update session is a resource which tracks changes to content. An update session is created with a set of files that are intended to be uploaded to a specific com.vmware.content.library_client.ItemModel, or removed from an item. The session object can be used to track the uploads and inspect the changes that are being made to the item by that upload. It can also serve as a channel to check on the result of the upload, and status messages such as errors and warnings for the upload.

Modifications are not visible to other clients unless the session is completed and all necessary files have been received.

The management of the files within the session is done through the com.vmware.content.library.item.updatesession_client.File class.

RESOURCE_TYPE = 'com.vmware.content.library.item.UpdateSession'

Resource type for an update session.

cancel(update_session_id)

Cancels the update session and sets its state to UpdateSessionModel.State.CANCELED. This method will free up any temporary resources currently associated with the session.

This method is not allowed if the session has been already completed.

Cancelling an update session will cancel any in progress transfers (either uploaded by the client or pulled by the server). Any content that has been already received will be scheduled for deletion.

Parameters:

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

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 UpdateSessionModel.State.ACTIVE state.

Raise:

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

  • Method execution requires System.Anonymous.
complete(update_session_id)

Completes the update session. This indicates that the client has finished making all the changes required to the underlying library item. If the client is pushing the content to the server, the library item will be updated once this call returns. If the server is pulling the content, the call may return before the changes become visible. In that case, the client can track the session to know when the server is done.

This method requires the session to be in the UpdateSessionModel.State.ACTIVE state.

Depending on the type of the library item associated with this session, a type adapter may be invoked to verify the validity of the files uploaded. The user can explicitly validate the session before completing the session by using the com.vmware.content.library.item.updatesession_client.File.validate() method.

Modifications are not visible to other clients unless the session is completed and all necessary files have been received.

Parameters:

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

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 UpdateSessionModel.State.ACTIVE state, or if some of the files that will be uploaded by the client aren’t received correctly.

Raise:

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

  • Method execution requires System.Anonymous.
create(create_spec, client_token=None)

Creates a new update session. An update session is used to make modifications to a library item. Modifications are not visible to other clients unless the session is completed and all necessary files have been received.

Content Library Service allows only one single update session to be active for a specific library item.

Parameters:
  • client_token (str or None) – Unique token generated by 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.
  • create_spec (UpdateSessionModel) – Specification for the new update session to be created.
Return type:

str

Returns:

Identifier of the new update session being created. The return value will be an identifier for the resource type: com.vmware.content.library.item.UpdateSession.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument if the session specification is not valid.

Raise:

com.vmware.vapi.std.errors_client.InvalidArgument if the client_token does not conform to the UUID format.

Raise:

com.vmware.vapi.std.errors_client.InvalidElementType if the update session is being created on a subscribed library item.

Raise:

com.vmware.vapi.std.errors_client.NotFound if the item targeted for update does not exist.

Raise:

com.vmware.vapi.std.errors_client.ResourceBusy if there is another update session on the same library item.

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 attribute UpdateSessionModel.library_item_id requires ContentLibrary.UpdateSession.
delete(update_session_id)

Deletes an update session. This removes the session and all information associated with it.

Removing an update session leaves any current transfers for that session in an indeterminate state (there is no guarantee that the server will terminate the transfers, or that the transfers can be completed). However there will no longer be a means of inspecting the status of those uploads except by seeing the effect on the library item.

Update sessions for which there is no upload activity or which are complete will automatically be deleted after a period of time.

Parameters:

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

Raise:

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

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the update session is in the UpdateSessionModel.State.ACTIVE state.

Raise:

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

  • Method execution requires System.Anonymous.
fail(update_session_id, client_error_message)

Terminates the update session with a client specified error message.

This is useful in transmitting client side failures (for example, not being able to access a file) to the server side.

Parameters:
  • update_session_id (str) – Identifier of the update session to fail. The parameter must be an identifier for the resource type: com.vmware.content.library.item.UpdateSession.
  • client_error_message (str) – Client side error message. This can be useful in providing some extra details about the client side failure. Note that the message won’t be translated to the user’s locale.
Raise:

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

Raise:

com.vmware.vapi.std.errors_client.NotAllowedInCurrentState if the update session is not in the UpdateSessionModel.State.ACTIVE state.

Raise:

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

  • Method execution requires System.Anonymous.
get(update_session_id)

Gets the update session with the specified identifier, including the most up-to-date status information for the session.

Parameters:

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

Return type:

UpdateSessionModel

Returns:

The UpdateSessionModel instance with the given update_session_id.

Raise:

com.vmware.vapi.std.errors_client.NotFound if no update session with the given identifier exists.

Raise:

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

  • Method execution requires System.Anonymous.
keep_alive(update_session_id, client_progress=None)

Keeps an update session alive.

If there is no activity for an update session after a period of time, the update session will expire, then be deleted. The update session expiration timeout is configurable in the Content Library Service system configuration. The default is five minutes. Invoking this method enables a client to specifically extend the lifetime of the update session.

Parameters:
  • update_session_id (str) – Identifier of the update session whose lifetime should be extended. The parameter must be an identifier for the resource type: com.vmware.content.library.item.UpdateSession.
  • client_progress (long or None) – Optional update to the progress property of the session. If specified, the new progress should be greater then the current progress. See UpdateSessionModel.client_progress. If not specified the progress is not updated.
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 UpdateSessionModel.State.ACTIVE state.

Raise:

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

  • Method execution requires System.Anonymous.
list(library_item_id=None)

Lists the identifiers of the update session created by the calling user. Optionally may filter by library item.

Parameters:

library_item_id (str or None) – Optional library item identifier on which to filter results. The parameter must be an identifier for the resource type: com.vmware.content.library.item.UpdateSession. If not specified the results are not filtered.

Return type:

list of str

Returns:

The list of identifiers of all update sessions created by the calling user. The return value will contain identifiers for the resource type: com.vmware.content.library.item.UpdateSession.

Raise:

com.vmware.vapi.std.errors_client.NotFound if a library item identifier is given for an item which does not 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.UpdateSession referenced by the parameter library_item_id requires ContentLibrary.UpdateSession.
class com.vmware.content.library.item_client.UpdateSessionModel(id=None, library_item_id=None, library_item_content_version=None, error_message=None, client_progress=None, state=None, expiration_time=None)

Bases: vmware.vapi.bindings.struct.VapiStruct

The UpdateSessionModel class provides information on an active UpdateSession resource.

Tip

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

class State(string)

Bases: vmware.vapi.bindings.enum.Enum

The state of an update session.

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.

ACTIVE = State(string='ACTIVE')

The session is currently active. This is the initial state when the session is created. Files may be uploaded by the client or pulled by the Content Library Service at this stage.

CANCELED = State(string='CANCELED')

The session has been canceled.

DONE = State(string='DONE')

The session is done and all its effects are now visible.

ERROR = State(string='ERROR')

There was an error during the session.