Class: Fog::Vcloud::Compute::Catalogs

Inherits:
Fog::Vcloud::Collection show all
Defined in:
lib/fog/vcloud/models/compute/catalogs.rb

Instance Method Summary collapse

Methods inherited from Fog::Vcloud::Collection

#check_href!, #load

Instance Method Details

#allObject



11
12
13
14
15
# File 'lib/fog/vcloud/models/compute/catalogs.rb', line 11

def all
  org_uri = self.organization_uri || service.default_organization_uri
  data = service.get_organization(org_uri).links.select { |link| link[:type] == "application/vnd.vmware.vcloud.catalog+xml" }
  load(data)
end

#get(uri) ⇒ Object



17
18
19
20
21
# File 'lib/fog/vcloud/models/compute/catalogs.rb', line 17

def get(uri)
  service.get_catalog(uri)
rescue Fog::Errors::NotFound
  nil
end

#item_by_name(name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/vcloud/models/compute/catalogs.rb', line 23

def item_by_name(name)
  res = nil
  items = all.map { |catalog| catalog.catalog_items }
  items.each do |i|
    i.map do |ii|
      res = ii if ii.name == name
    end
  end
  res
end