Class List Method List File List

# Class: Com::Vmware::Content::Library::ItemService

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

## Overview

The ``Com::Vmware::Content::Library::Item`` class provides methods for managing library items.

## Defined Under Namespace

Classes: FindSpec

## Constant Summary

RESOURCE_TYPE =

      'com.vmware.content.library.Item'

## Instance Method Summary (collapse)

- - (String) copy(source_library_item_id, destination_create_spec, client_token = nil)

  Copies a library item.

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

  Creates a new library item.

- - (Void) delete(library_item_id)

  Deletes a library item.

- - (Array<String>) find(spec)

  Returns identifiers of all the visible (as determined by authorization policy) library items matching the requested :class:`Com::Vmware::Content::Library::Item::FindSpec` .

- - (Com::Vmware::Content::Library::ItemModel) get(library_item_id)

  Returns the :class:`Com::Vmware::Content::Library::ItemModel` with the given identifier.

- - (ItemService) initialize(config) constructor

  Constructs a new instance.

- - (Array<String>) list(library_id)

  Returns the identifiers of all items in the given library.

- - (Void) update(library_item_id, update_spec)

  Updates the specified properties of a library item.

## Constructor Details

### - (`ItemService`) initialize(config)

Constructs a new instance.

Parameters:

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

  A hash with the api provider details.

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

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

## Instance Method Details

### - (`String`) copy(source_library_item_id, destination_create_spec, client_token = nil)

Copies a library item.

     Copying a library item allows a duplicate to be made within the same or different library. The copy occurs by first creating a new library item, whose identifier is returned. The content of the library item is then copied asynchronously. This copy can be tracked as a task.

     If the copy fails, Content Library Service will roll back the copy by deleting any content that was already copied, and removing the new library item. A failure during rollback may require manual cleanup by an administrator.

     A library item cannot be copied into a subscribed library.

        If not specified copy is not idempotent.

Parameters:

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

  A unique token generated on the client for each copy 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 copy.

- source_library_item_id (`String`) —

  Identifier of the existing library item from which the content will be copied.

- destination_create_spec (`Com::Vmware::Content::Library::ItemModel`) —

  Specification for the new library item to be created.

Returns:

- (`String`) —

  The identifier of the new library item into which the content is being copied.

Raises:

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

  if the library item with ``source_library_item_id`` does not exist, or if the library referenced by the :attr:`Com::Vmware::Content::Library::ItemModel.library_id` property of ``destination_create_spec`` does not exist.

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

  if one of the following is true for the new library item:

       * name is empty
        * name exceeds 80 characters
        * description exceeds 1024 characters

- (`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 :attr:`Com::Vmware::Content::Library::ItemModel.library_id` property of ``destination_create_spec`` refers to a subscribed library.

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

  if the copy operation failed because the source or destination library item is not accessible.

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

    def copy(source_library_item_id, destination_create_spec, client_token=nil)
        invoke_with_info(@@copy_info, {
            'client_token' => client_token,
            'source_library_item_id' => source_library_item_id,
            'destination_create_spec' => destination_create_spec,
        })
    end

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

Creates a new library item.

     A new library item is created without any content. After creation, content can be added through the   :class:`Com::Vmware::Content::Library::Item::UpdateSession`   and   :class:`Com::Vmware::Content::Library::Item::Updatesession::File`    classs .

     A library item cannot be created in a subscribed library.

        If not specified creation is not idempotent.

Parameters:

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

  A unique token generated on 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::ItemModel`) —

  Specification that defines the properties of the new library item.

Returns:

- (`String`) —

  Identifier of the new library item.

Raises:

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

  if the :attr:`Com::Vmware::Content::Library::ItemModel.library_id` property of ``create_spec`` refers to a library that does not exist.

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

  if one of the following is true for the new library item:

       * name is empty
        * name exceeds 80 characters
        * description exceeds 1024 characters

- (`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 :attr:`Com::Vmware::Content::Library::ItemModel.library_id` property of ``destinationCreateSpec`` refers to a subscribed library.

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

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

### - (`Void`) delete(library_item_id)

Deletes a library item.

     This  method  will immediately remove the item from the library that owns it. The content of the item will be asynchronously removed from the storage backings. The content deletion can be tracked with a task. In the event that the task fails, an administrator may need to manually remove the files from the storage backing.

     This  method  cannot be used to delete a library item that is a member of a subscribed library. Removing an item from a subscribed library requires deleting the item from the original published local library and syncing the subscribed library.

Parameters:

- library_item_id (`String`) —

  Identifier of the library item to delete.

Returns:

- (`Void`)

Raises:

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

  if the library item with the given ``library_item_id`` is a member of a subscribed library.

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

  if the library item with the specified ``library_item_id`` does not exist.

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

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

### - (`Array<String>`) find(spec)

Returns identifiers of all the visible (as determined by authorization policy) library items matching the requested :class:`Com::Vmware::Content::Library::Item::FindSpec` .

Parameters:

- spec (`Com::Vmware::Content::Library::Item::FindSpec`) —

  Specification describing what properties to filter on.

Returns:

- (`Array<String>`) —

  The list of identifiers of all the visible library items matching the given ``spec`` .

Raises:

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

  if no properties are specified in the ``spec`` .

    282
    283
    284
    285
    286
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library.rb', line 282

    def find(spec)
        invoke_with_info(@@find_info, {
            'spec' => spec,
        })
    end

### - (`Com::Vmware::Content::Library::ItemModel`) get(library_item_id)

Returns the :class:`Com::Vmware::Content::Library::ItemModel` with the given identifier.

Parameters:

- library_item_id (`String`) —

  Identifier of the library item to return.

Returns:

- (`Com::Vmware::Content::Library::ItemModel`) —

  The :class:`Com::Vmware::Content::Library::ItemModel` instance with the given ``library_item_id`` .

Raises:

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

  if no item with the given ``library_item_id`` exists.

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

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

### - (`Array<String>`) list(library_id)

Returns the identifiers of all items in the given library.

Parameters:

- library_id (`String`) —

  Identifier of the library whose items should be returned.

Returns:

- (`Array<String>`) —

  The list of identifiers of the items in the library specified by ``library_id`` .

Raises:

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

  if the library associated with ``library_id`` does not exist.

    267
    268
    269
    270
    271
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library.rb', line 267

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

### - (`Void`) update(library_item_id, update_spec)

Updates the specified properties of a library item.

     This is an incremental update to the library item.  Fields  that are  nil  in the update specification are left unchanged.

     This  method  cannot update a library item that is a member of a subscribed library. Those items must be updated in the source published library and synchronized to the subscribed library.

Parameters:

- library_item_id (`String`) —

  Identifier of the library item to update.

- update_spec (`Com::Vmware::Content::Library::ItemModel`) —

  Specification of the properties to set.

Returns:

- (`Void`)

Raises:

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

  if the library item specified by ``library_item_id`` does not exist.

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

  if the library item corresponding to ``library_item_id`` is a member of a subscribed library.

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

  if one of the following is true for the ``update_spec`` :

       * name is empty
        * name exceeds 80 characters
        * description exceeds 1024 characters
        * version is not equal to the current version of the library item

    312
    313
    314
    315
    316
    317
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/content/library.rb', line 312

    def update(library_item_id, update_spec)
        invoke_with_info(@@update_info, {
            'library_item_id' => library_item_id,
            'update_spec' => update_spec,
        })
    end