com.vmware.content.library package¶
Subpackages¶
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.- Parameters
config (
vmware.vapi.bindings.stub.StubConfiguration
) – Configuration to be used for creating the stub.
-
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 theDownloadSessionModel.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
orNone
) – 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
- 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 attributeDownloadSessionModel.library_item_id
requiresContentLibrary.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 theDownloadSessionModel.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
- Returns
The
DownloadSessionModel
instance with the givendownload_session_id
.- Raise
com.vmware.vapi.std.errors_client.NotFound
if no download session with the givendownload_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
orNone
) – Optional update to the progress property of the session. If specified, the new progress should be greater then the current progress. SeeDownloadSessionModel.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 theDownloadSessionModel.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
orNone
) – 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
ofstr
- 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 parameterlibrary_item_id
requiresContentLibrary.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 activeDownloadSession
resource.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
id (
str
) – The identifier of this download session. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:com.vmware.content.library.item.DownloadSession
. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:com.vmware.content.library.item.DownloadSession
. This attribute is not used for thecreate
method. It will not be present in the return value of theget
orlist
methods. It is not used for theupdate
method.library_item_id (
str
) – The identifier of the library item whose content is being downloaded. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:com.vmware.content.library.Item
. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:com.vmware.content.library.Item
. This attribute must be provided for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.library_item_content_version (
str
) – The content version of the library item whose content is being downloaded. This value is thecom.vmware.content.library_client.ItemModel.content_version
at the time when the session is created for the library item. This attribute is not used for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.error_message (
com.vmware.vapi.std_client.LocalizableMessage
) – If the session is in theDownloadSessionModel.State.ERROR
status this property will have more details about the error. This attribute is not used for thecreate
method. It is optional in the return value of theget
orlist
methods. It is not used for theupdate
method.client_progress (
long
) – The progress that has been made with the download. This property is to be updated by the client during the download process to indicate the progress of its work in completing the download. The initial progress is 0 until updated by the client. The maximum value is 100, which indicates that the download is complete. This attribute is not used for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is optional for theupdate
method.state (
DownloadSessionModel.State
) – The current state (ACTIVE, CANCELED, ERROR) of the download session. This attribute is not used for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.expiration_time (
datetime.datetime
) – Indicates the time after which the session will expire. The session is guaranteed not to expire before this time. This attribute is not used for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.
-
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.
- Parameters
string (
str
) – String value for theState
instance.
-
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 theUpdateSession
andcom.vmware.content.library.item.updatesession_client.File
classes.- Parameters
config (
vmware.vapi.bindings.stub.StubConfiguration
) – Configuration to be used for creating the stub.
-
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.
- Parameters
string (
str
) – String value for theChecksumAlgorithm
instance.
-
MD5
= ChecksumAlgorithm(string='MD5')¶ Checksum algorithm: MD5
-
SHA1
= ChecksumAlgorithm(string='SHA1')¶ Checksum algorithm: SHA-1
-
SHA256
= ChecksumAlgorithm(string='SHA256')¶ Checksum algorithm: SHA-256. This class attribute was added in vSphere API 6.8.
-
SHA512
= ChecksumAlgorithm(string='SHA512')¶ Checksum algorithm: SHA-512. This class attribute was added in vSphere API 6.8.
-
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.
- Parameters
algorithm (
File.ChecksumAlgorithm
orNone
) – The checksum algorithm (SHA1, MD5, SHA256, SHA512) used to calculate the checksum. If not specified the default checksum algorithm isFile.ChecksumAlgorithm.SHA1
.checksum (
str
) – The checksum value calculated withFile.ChecksumInfo.algorithm
.
-
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.
- Parameters
checksum_info (
File.ChecksumInfo
orNone
) –A checksum for validating the content of the file.
This value can be used to verify that a transfer was completed without errors. A checksum cannot always be calculated, and the value will be None if the file does not have content.
name (
str
) –The name of the file.
This value will be unique within the library item for each file. It cannot be an empty string.
size (
long
) – The file size, in bytes. The file size is the storage used and not the uploaded or provisioned size. For example, when uploading a disk to a datastore, the amount of storage that the disk consumes may be different from the disk file size. When the file is not cached, the size is 0.cached (
bool
) – Indicates whether the file is on disk or not.version (
str
) – The version of this file; incremented when a new copy of the file is uploaded.
-
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
- Returns
The
File.Info
object with information on the specified file.- Raise
com.vmware.vapi.std.errors_client.NotFound
iflibrary_item_id
refers to a library item that does not exist.- Raise
com.vmware.vapi.std.errors_client.NotFound
ifname
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 parameterlibrary_item_id
requiresSystem.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
- Returns
The
list
of all of the files that are stored within the given library item.- Raise
com.vmware.vapi.std.errors_client.NotFound
iflibrary_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 parameterlibrary_item_id
requiresSystem.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. UnlikeFile
, which is abstract, storage represents concrete files on the various storage backings. A file is only represented once inFile
, but will be represented multiple times (once for each storage backing) inStorage
. TheStorage
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.- Parameters
config (
vmware.vapi.bindings.stub.StubConfiguration
) – Configuration to be used for creating the stub.
-
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 ofFile.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.
- Parameters
storage_backing (
com.vmware.content.library_client.StorageBacking
) – The storage backing on which this object resides. This might not be the same as the default storage backing associated with the library.storage_uris (
list
ofstr
) –URIs that identify the file on the storage backing.
These URIs may be specific to the backing and may need interpretation by the client. A client that understands a URI scheme in this list may use that URI to directly access the file on the storage backing. This can provide high-performance support for file manipulation.
checksum_info (
File.ChecksumInfo
orNone
) –A checksum for validating the content of the file.
This value can be used to verify that a transfer was completed without errors. A checksum cannot always be calculated, and the value will be None if the file does not have content.
name (
str
) –The name of the file.
This value will be unique within the library item for each file. It cannot be an empty string.
size (
long
) – The file size, in bytes. The file size is the storage used and not the uploaded or provisioned size. For example, when uploading a disk to a datastore, the amount of storage that the disk consumes may be different from the disk file size. When the file is not cached, the size is 0.cached (
bool
) – Indicates whether the file is on disk or not.version (
str
) – The version of this file; incremented when a new copy of the file is uploaded.
-
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
ofStorage.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 parameterlibrary_item_id
requiresContentLibrary.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
ofStorage.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 parameterlibrary_item_id
requiresContentLibrary.ReadStorage
.
-
class
com.vmware.content.library.item_client.
StubFactory
(stub_config)¶ Bases:
vmware.vapi.bindings.stub.StubFactoryBase
Initialize StubFactoryBase
- Parameters
stub_config (
vmware.vapi.bindings.stub.StubConfiguration
) – Stub config instance
-
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.
- Parameters
uri (
str
) –Transfer endpoint URI. The supported URI schemes are:
http
,https
,file
, andds
.An endpoint URI with the
ds
scheme specifies the location of the file on the datastore. The format of the datastore URI is:ds:///vmfs/volumes/uuid/path
Some examples of valid file URI formats are:
When the transfer endpoint is a file or datastore location, the server can import the file directly from the storage backing without the overhead of streaming over HTTP.
ssl_certificate_thumbprint (
str
orNone
) – Thumbprint of the expected SSL certificate for this endpoint. Only used for HTTPS connections. The thumbprint is the SHA-1 hash of the DER encoding of the remote endpoint’s SSL certificate. If set, the remote endpoint’s SSL certificate is only accepted if it matches this thumbprint, and no other certificate validation is performed. If not specified, standard certificate validation is performed.
-
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.
- Parameters
string (
str
) – String value for theTransferStatus
instance.
-
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.- Parameters
config (
vmware.vapi.bindings.stub.StubConfiguration
) – Configuration to be used for creating the stub.
-
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 theUpdateSessionModel.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 theUpdateSessionModel.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
orNone
) – 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 theclient_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 attributeUpdateSessionModel.library_item_id
requiresContentLibrary.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 theUpdateSessionModel.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 theUpdateSessionModel.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
- Returns
The
UpdateSessionModel
instance with the givenupdate_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
orNone
) – Optional update to the progress property of the session. If specified, the new progress should be greater then the current progress. SeeUpdateSessionModel.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 theUpdateSessionModel.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
orNone
) – 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
ofstr
- 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 parameterlibrary_item_id
requiresContentLibrary.UpdateSession
.
-
update
(update_session_id, update_spec)¶ Updates the properties of an update session.
This is an incremental update to the update session. Any attribute in the
UpdateSessionModel
class that is None will not be modified.This method will only update the property
UpdateSessionModel.warning_behavior
of the update session. This will not, for example, update theUpdateSessionModel.library_item_id
orUpdateSessionModel.state
of an update session.This method requires the session to be in the
UpdateSessionModel.State.ACTIVE
state.. This method was added in vSphere API 6.8.- Parameters
update_session_id (
str
) – Identifer of the update session that should be updated. The parameter must be an identifier for the resource type:com.vmware.content.library.item.UpdateSession
.update_spec (
UpdateSessionModel
) – Specification for the new property values to be set on the update session.
- 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 theUpdateSessionModel.State.ACTIVE
state.- Raise
com.vmware.vapi.std.errors_client.InvalidArgument
if the update session specification is not valid.- 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
.
-
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, preview_info=None, warning_behavior=None)¶ Bases:
vmware.vapi.bindings.struct.VapiStruct
The
UpdateSessionModel
class provides information on an activeUpdateSession
resource.Tip
The arguments are used to initialize data attributes with the same names.
- Parameters
id (
str
) – The identifier of this update session. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:com.vmware.content.library.item.UpdateSession
. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:com.vmware.content.library.item.UpdateSession
. This attribute is not used for thecreate
method. It will not be present in the return value of theget
orlist
methods. It is not used for theupdate
method.library_item_id (
str
) – The identifier of the library item to which content will be uploaded or removed. When clients pass a value of this class as a parameter, the attribute must be an identifier for the resource type:com.vmware.content.library.Item
. When methods return a value of this class as a return value, the attribute will be an identifier for the resource type:com.vmware.content.library.Item
. This attribute must be provided for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.library_item_content_version (
str
) – The content version of the library item whose content is being modified. This value is thecom.vmware.content.library_client.ItemModel.content_version
at the time when the session is created for the library item. This attribute is not used for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.error_message (
com.vmware.vapi.std_client.LocalizableMessage
) – If the session is in theUpdateSessionModel.State.ERROR
status this property will have more details about the error. This attribute is not used for thecreate
method. It is optional in the return value of theget
orlist
methods. It is not used for theupdate
method.client_progress (
long
) – The progress that has been made with the upload. This property is to be updated by the client during the upload process to indicate the progress of its work in completing the upload. The initial progress is 0 until updated by the client. The maximum value is 100, which indicates that the update is complete. This attribute is not used for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.state (
UpdateSessionModel.State
) – The current state (ACTIVE, DONE, ERROR, CANCELED) of the update session. This attribute was added in vSphere API 6.8. This attribute is not used for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.expiration_time (
datetime.datetime
) – Indicates the time after which the session will expire. The session is guaranteed not to expire earlier than this time. This attribute is not used for thecreate
method. It will always be present in the return value of theget
orlist
methods. It is not used for theupdate
method.preview_info (
com.vmware.content.library.item.updatesession_client.PreviewInfo
) – A preview of the files currently being uploaded in the session. This property will be set only when the session is in theUpdateSessionModel.State.ACTIVE
. This attribute was added in vSphere API 6.8. This attribute is optional and it is only relevant when the value ofstate
isUpdateSessionModel.State.ACTIVE
.warning_behavior (
list
ofcom.vmware.content.library.item.updatesession_client.WarningBehavior
) – Indicates the update session behavior if warnings are raised in the session preview. Any warning which is raised by session preview but not ignored by the client will, by default, fail the update session. This attribute was added in vSphere API 6.8. This attribute is optional for thecreate
method. It is optional in the return value of theget
orlist
methods. It is optional for theupdate
method.
-
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.
- Parameters
string (
str
) – String value for theState
instance.
-
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.