Class: VCloud::Catalog

Inherits:
BaseVCloudEntity show all
Defined in:
lib/vcloud/user/catalog.rb

Overview

Contains a collection of CatalogItem references

Instance Method Summary collapse

Methods inherited from BaseVCloudEntity

attr_accessor, attr_reader, attr_writer, from_reference, inherited, #initialize, type

Methods included from RestApi

#build_generic_http_opts, #create, #delete, #http_request, #parse_response, #post, #refresh, #update

Constructor Details

This class inherits a constructor from VCloud::BaseVCloudEntity

Instance Method Details

#get_catalog_item_from_name(name, session = self.session) ⇒ VCloud::CatalogItem

Retrieves an CatalogItem, assuming the user has access to it

Parameters:

  • name (String)

    CatalogItem name

  • session (VCloud::Client) (defaults to: self.session)

    Session to use to retrieve the CatalogItem

Returns:



26
27
28
29
30
# File 'lib/vcloud/user/catalog.rb', line 26

def get_catalog_item_from_name(name, session = self.session)
  catalog_items = get_catalog_item_references_by_name
  item = catalog_items[name] or return nil
  CatalogItem.from_reference(item, session)
end

#get_catalog_item_references_by_nameHash{String => VCloud::Reference}

Returns a hash of of all CatalogItem references, keyed by the CatalogItem name

Returns:

  • (Hash{String => VCloud::Reference})

    Reference to all CatalogsItems in the Catalog, keyed by name



17
18
19
# File 'lib/vcloud/user/catalog.rb', line 17

def get_catalog_item_references_by_name
  Hash[catalog_item_references.collect{ |i| [i.name, i] }]
end