Class List Method List File List

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

Inherits:
  VAPI::Bindings::VapiService
  - Object
  - VAPI::Bindings::VapiService
  - Com::Vmware::Content::Library::Item::DownloadSession
  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::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   :class:`Com::Vmware::Content::Library::Item::Downloadsession::File`    class  provides access to the download links.

## Constant Summary

RESOURCE_TYPE =

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

## Instance Method Summary (collapse)

- - (Void) cancel(download_session_id)

  Cancels the download session.

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

  Creates a new download session.

- - (Void) delete(download_session_id)

  Deletes a download session.

- - (Void) fail(download_session_id, client_error_message)

  Terminates the download session with a client specified error message.

- - (Com::Vmware::Content::Library::Item::DownloadSessionModel) get(download_session_id)

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

- - (DownloadSession) initialize(config) constructor

  Constructs a new instance.

- - (Void) keep_alive(download_session_id, progress = nil)

  Keeps a download session alive.

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

  Lists the identifiers of the download sessions created by the calling user.

## Constructor Details

### - (`DownloadSession`) initialize(config)

Constructs a new instance.

Parameters:

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

  A hash with the api provider details.

    143
    144
    145
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 143

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

## Instance Method Details

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

  Identifer of the download session that should be canceled.

Returns:

- (`Void`)

Raises:

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

  if no download session with the given identifier exists.

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

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

    235
    236
    237
    238
    239
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 235

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

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

Creates a new download session.

        If not specified creation is not idempotent.

Parameters:

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

  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.

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

  Specification for the new download session to be created.

Returns:

- (`String`) —

  Identifier of the new download session being created.

Raises:

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

  if the session specification is not valid.

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

  format.

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

  if the library item targeted by the download does not exist.

    165
    166
    167
    168
    169
    170
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 165

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

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

  Identifier of the download session to be deleted.

Returns:

- (`Void`)

Raises:

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

  if the download session does not exist.

    253
    254
    255
    256
    257
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 253

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

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

  Identifier of the download 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 download session does not exist.

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

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

    273
    274
    275
    276
    277
    278
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 273

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

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

  Identifier of the download session to retrieve.

Returns:

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

  The :class:`Com::Vmware::Content::Library::Item::DownloadSessionModel` instance with the given ``download_session_id`` .

Raises:

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

  if no download session with the given ``download_session_id`` exists.

    181
    182
    183
    184
    185
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 181

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

### - (`Void`) keep_alive(download_session_id, progress = nil)

Keeps a download session alive. This operation is allowed only if the session is in the :attr:`Com::Vmware::Content::Library::Item::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.

        If not specified the progress is not updated.

Parameters:

- download_session_id (`String`) —

  Identifier of the download session whose lifetime should be extended.

- 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::DownloadSessionModel.client_progress` .

Returns:

- (`Void`)

Raises:

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

  if no download session with the given identifier exists.

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

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

    218
    219
    220
    221
    222
    223
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 218

    def keep_alive(download_session_id, progress=nil)
        invoke_with_info(@@keep_alive_info, {
            'download_session_id' => download_session_id,
            'progress' => progress,
        })
    end

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

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

        If not specified all download session identifiers are listed.

Parameters:

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

  Library item identifier on which to filter results.

Returns:

- (`Array<String>`) —

  The list of identifiers of all download 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.

    197
    198
    199
    200
    201
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library/item.rb', line 197

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