Class List Method List File List

# Class: Com::Vmware::Content::Library::Item::UpdateSession

Inherits:
  VAPI::Bindings::VapiService
  - Object
  - VAPI::Bindings::VapiService
  - Com::Vmware::Content::Library::Item::UpdateSession
  show all
Defined in:
  /build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb

## Overview

The ``Com::Vmware::Content::Library::Item::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   :class:`Com::Vmware::Content::Library::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   :class:`Com::Vmware::Content::Library::Item::Updatesession::File`    class .

## Constant Summary

RESOURCE_TYPE =

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

## Instance Method Summary (collapse)

- - (Void) cancel(update_session_id)

  Cancels the update session and deletes it.

- - (Void) complete(update_session_id)

  Completes the update session.

- - (String) create(create_spec, client_token = nil)

  Creates a new update session.

- - (Void) delete(update_session_id)

  Deletes an update session.

- - (Void) fail(update_session_id, client_error_message)

  Terminates the update session with a client specified error message.

- - (Com::Vmware::Content::Library::Item::UpdateSessionModel) get(update_session_id)

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

- - (UpdateSession) initialize(config) constructor

  Constructs a new instance.

- - (Void) keep_alive(update_session_id, client_progress = nil)

  Keeps an update session alive.

- - (Array<String>) list(library_item_id = nil)

  Lists the identifiers of the update session created by the calling user.

## Constructor Details

### - (`UpdateSession`) initialize(config)

Constructs a new instance.

Parameters:

- config (`VAPI::Bindings::StubConfig`) —

  A hash with the api provider details.

    805
    806
    807
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 805

    def initialize(config)
        super(config, @@service_info)
    end

## Instance Method Details

### - (`Void`) cancel(update_session_id)

Cancels the update session and deletes it. 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 (`String`) —

  Identifier of the update session that should be canceled.

Returns:

- (`Void`)

Raises:

- (`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.

    929
    930
    931
    932
    933
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 929

    def cancel(update_session_id)
        invoke_with_info(@@cancel_info, {
            'update_session_id' => update_session_id,
        })
    end

### - (`Void`) 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   :attr:`Com::Vmware::Content::Library::Item::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   :func:`Com::Vmware::Content::Library::Item::Updatesession::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 (`String`) —

  Identifier of the update session that should be completed.

Returns:

- (`Void`)

Raises:

- (`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.

    887
    888
    889
    890
    891
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 887

    def complete(update_session_id)
        invoke_with_info(@@complete_info, {
            'update_session_id' => update_session_id,
        })
    end

### - (`String`) create(create_spec, client_token = nil)

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.

        If not specified creation is not idempotent.

Parameters:

- client_token (`String`, `nil`) (defaults to: `nil`) —

  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.

- create_spec (`Com::Vmware::Content::Library::Item::UpdateSessionModel`) —

  Specification for the new update session to be created.

Returns:

- (`String`) —

  Identifier of the new update session being created.

Raises:

- (`Com::Vmware::Vapi::Std::Errors::InvalidArgument`) —

  if the session specification is not valid.

- (`Com::Vmware::Vapi::Std::Errors::InvalidArgument`) —

  if the ``client_token`` does not conform to the UUID format.

- (`Com::Vmware::Vapi::Std::Errors::InvalidElementType`) —

  if the update session is being created on a subscribed library item.

- (`Com::Vmware::Vapi::Std::Errors::NotFound`) —

  if the item targeted for update does not exist.

- (`Com::Vmware::Vapi::Std::Errors::ResourceBusy`) —

  if there is another update session on the same library item.

    833
    834
    835
    836
    837
    838
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 833

    def create(create_spec, client_token=nil)
        invoke_with_info(@@create_info, {
            'client_token' => client_token,
            'create_spec' => create_spec,
        })
    end

### - (`Void`) 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 (`String`) —

  Identifer of the update session to delete.

Returns:

- (`Void`)

Raises:

- (`Com::Vmware::Vapi::Std::Errors::NotFound`) —

  if the update session does not exist.

- (`Com::Vmware::Vapi::Std::Errors::NotAllowedInCurrentState`) —

  if the update session is in the :attr:`Com::Vmware::Content::Library::Item::UpdateSessionModel::State.ACTIVE` state.

    970
    971
    972
    973
    974
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 970

    def delete(update_session_id)
        invoke_with_info(@@delete_info, {
            'update_session_id' => update_session_id,
        })
    end

### - (`Void`) 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 (`String`) —

  Identifier of the update session to fail.

- client_error_message (`String`) —

  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.

Returns:

- (`Void`)

Raises:

- (`Com::Vmware::Vapi::Std::Errors::NotFound`) —

  if the update session does not exist.

- (`Com::Vmware::Vapi::Std::Errors::NotAllowedInCurrentState`) —

  if the update session is not in the :attr:`Com::Vmware::Content::Library::Item::UpdateSessionModel::State.ACTIVE` state.

    949
    950
    951
    952
    953
    954
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 949

    def fail(update_session_id, client_error_message)
        invoke_with_info(@@fail_info, {
            'update_session_id' => update_session_id,
            'client_error_message' => client_error_message,
        })
    end

### - (`Com::Vmware::Content::Library::Item::UpdateSessionModel`) 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 (`String`) —

  Identifier of the update session to retrieve.

Returns:

- (`Com::Vmware::Content::Library::Item::UpdateSessionModel`) —

  The :class:`Com::Vmware::Content::Library::Item::UpdateSessionModel` instance with the given ``update_session_id`` .

Raises:

- (`Com::Vmware::Vapi::Std::Errors::NotFound`) —

  if no update session with the given identifier exists.

    849
    850
    851
    852
    853
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 849

    def get(update_session_id)
        invoke_with_info(@@get_info, {
            'update_session_id' => update_session_id,
        })
    end

### - (`Void`) keep_alive(update_session_id, client_progress = nil)

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.

        If not specified the progress is not updated.

Parameters:

- update_session_id (`String`) —

  Identifier of the update session whose lifetime should be extended.

- client_progress (`Fixnum`, `nil`) (defaults to: `nil`) —

  Optional update to the progress property of the session. If specified, the new progress should be greater then the current progress. See :attr:`Com::Vmware::Content::Library::Item::UpdateSessionModel.client_progress` .

Returns:

- (`Void`)

Raises:

- (`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.

    908
    909
    910
    911
    912
    913
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 908

    def keep_alive(update_session_id, client_progress=nil)
        invoke_with_info(@@keep_alive_info, {
            'update_session_id' => update_session_id,
            'client_progress' => client_progress,
        })
    end

### - (`Array<String>`) list(library_item_id = nil)

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

        If not specified the results are not filtered.

Parameters:

- library_item_id (`String`, `nil`) (defaults to: `nil`) —

  Optional library item identifier on which to filter results.

Returns:

- (`Array<String>`) —

  The list of identifiers of all update sessions created by the calling user.

Raises:

- (`Com::Vmware::Vapi::Std::Errors::NotFound`) —

  if a library item identifier is given for an item which does not exist.

    865
    866
    867
    868
    869
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 865

    def list(library_item_id=nil)
        invoke_with_info(@@list_info, {
            'library_item_id' => library_item_id,
        })
    end