mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
miscelanea
This commit is contained in:
parent
9204be2209
commit
fe8b99b544
5 changed files with 15 additions and 9 deletions
|
@ -51,6 +51,8 @@ module Fog
|
|||
collection :catalogs
|
||||
model :catalog_item
|
||||
collection :catalog_items
|
||||
model :vdc
|
||||
collection :vdcs
|
||||
|
||||
request_path 'fog/vcloudng/requests/compute'
|
||||
request :get_organizations
|
||||
|
|
|
@ -15,7 +15,8 @@ module Fog
|
|||
attribute :is_published, :aliases => 'IsPublished'
|
||||
|
||||
def catalog_items
|
||||
|
||||
requires :id
|
||||
service.catalog_items(:catalog => self)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -10,11 +10,11 @@ module Fog
|
|||
|
||||
attribute :organization
|
||||
|
||||
def all
|
||||
data = service.get_organization(organization.id).body
|
||||
def all(organization_id = organization.id)
|
||||
data = service.get_organization(organization_id).body
|
||||
catalogs = data["Links"].select { |link| link["type"] == "application/vnd.vmware.vcloud.catalog+xml" }
|
||||
catalogs.each {|catalog| catalog['id'] =catalog['href'].split('/').last }
|
||||
load(catalogs)
|
||||
catalog_ids = catalogs.map {|catalog| catalog['href'].split('/').last }
|
||||
catalog_ids.map{ |catalog_id| get(catalog_id)}
|
||||
end
|
||||
|
||||
def get(catalog_id)
|
||||
|
|
|
@ -12,15 +12,14 @@ module Fog
|
|||
attribute :type
|
||||
attribute :href
|
||||
attribute :description, :aliases => 'Description'
|
||||
attribute :links, :aliases => 'Links'
|
||||
|
||||
def vdc
|
||||
|
||||
def vdcs
|
||||
requires :id
|
||||
service.vdcs(:organization => self)
|
||||
end
|
||||
|
||||
def catalogs
|
||||
requires :id
|
||||
|
||||
service.catalogs(:organization => self)
|
||||
end
|
||||
|
||||
|
|
|
@ -25,10 +25,14 @@ module Fog
|
|||
when 'Entity'
|
||||
entity_item = extract_attributes(attributes)
|
||||
entity_item["id"] = entity_item["href"].split('/').last
|
||||
@response['vapp_template_id'] = entity_item["id"]
|
||||
@response['Entity'] = entity_item
|
||||
when 'CatalogItem'
|
||||
catalog_item = extract_attributes(attributes)
|
||||
@response['name'] = catalog_item['name']
|
||||
@response['type'] = catalog_item['type']
|
||||
@response['href'] = catalog_item['href']
|
||||
@response['id'] = catalog_item['href'].split('/').last
|
||||
when "Link"
|
||||
link = extract_attributes(attributes)
|
||||
@response["Links"] << link
|
||||
|
|
Loading…
Reference in a new issue