mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
get_catalog_item implemented
This commit is contained in:
parent
6c31c248bd
commit
c1385081a9
3 changed files with 84 additions and 3 deletions
36
lib/fog/vcloudng/parsers/compute/get_catalog_item.rb
Normal file
36
lib/fog/vcloudng/parsers/compute/get_catalog_item.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module Vcloudng
|
||||
module Compute
|
||||
|
||||
class GetCatalogItem < VcloudngParser
|
||||
|
||||
def reset
|
||||
@response = { 'Entity' => {}, 'Properties' => {} }
|
||||
end
|
||||
|
||||
def start_element(name, attributes)
|
||||
super
|
||||
case name
|
||||
when 'Entity'
|
||||
@response['Entity'] = extract_attributes(attributes)
|
||||
when 'CatalogItem'
|
||||
catalog_item = extract_attributes(attributes)
|
||||
@response['name'] = catalog_item['name']
|
||||
when 'Property'
|
||||
@property_key = attributes.value
|
||||
end
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
if name == 'Property'
|
||||
@response['Properties'][@property_key] = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
47
lib/fog/vcloudng/requests/compute/get_catalog_item.rb
Normal file
47
lib/fog/vcloudng/requests/compute/get_catalog_item.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
module Fog
|
||||
module Vcloudng
|
||||
module Compute
|
||||
class Real
|
||||
|
||||
require 'fog/vcloudng/parsers/compute/get_catalog_item'
|
||||
|
||||
# Get details of a catalog item
|
||||
#
|
||||
# ==== Parameters
|
||||
# * catalog_item_uuid<~Integer> - Id of catalog item to lookup
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
|
||||
# FIXME
|
||||
|
||||
# * 'CatalogItems'<~Array>
|
||||
# * 'href'<~String> - linke to item
|
||||
# * 'name'<~String> - name of item
|
||||
# * 'type'<~String> - type of item
|
||||
# * 'description'<~String> - Description of catalog
|
||||
# * 'name'<~String> - Name of catalog
|
||||
#
|
||||
# === How to get the catalog_uuid?
|
||||
# org_uuid = vcloud.get_organizations.data[:body]["OrgList"].first["href"].split('/').last # get the first one
|
||||
# org = vcloud.get_organization(org_uuid)
|
||||
#
|
||||
# catalog_uuid = org.data[:body]["Links"].detect {|l| l["type"] =~ /vcloud.catalog/ }["href"].split('/').last
|
||||
# catalog = vcloud.get_catalog(catalog_uuid)
|
||||
# catalog_item_uuid = catalog.body["CatalogItems"].first["href"].split('/').last # get the first one
|
||||
#
|
||||
def get_catalog_item(catalog_item_uuid)
|
||||
request(
|
||||
:expects => 200,
|
||||
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::Vcloudng::Compute::GetCatalogItem.new,
|
||||
:path => "catalogItem/#{catalog_item_uuid}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -252,8 +252,6 @@ module Fog
|
|||
#require 'fog/vcloudng/models/compute/internetservices'
|
||||
#require 'fog/vcloudng/models/compute/nodeservice'
|
||||
#require 'fog/vcloudng/models/compute/nodeservices'
|
||||
#
|
||||
#require 'fog/vcloudng/parsers/compute/get_catalog_item'
|
||||
#require 'fog/vcloudng/parsers/compute/get_internet_services'
|
||||
#require 'fog/vcloudng/parsers/compute/get_network_ips'
|
||||
#require 'fog/vcloudng/parsers/compute/get_node_services'
|
||||
|
@ -278,7 +276,7 @@ module Fog
|
|||
#require 'fog/vcloudng/requests/compute/delete_vapp'
|
||||
#require 'fog/vcloudng/requests/compute/deploy_vapp'
|
||||
require 'fog/vcloudng/requests/compute/get_catalog'
|
||||
#require 'fog/vcloudng/requests/compute/get_catalog_item'
|
||||
require 'fog/vcloudng/requests/compute/get_catalog_item'
|
||||
#require 'fog/vcloudng/requests/compute/get_internet_services'
|
||||
#require 'fog/vcloudng/requests/compute/get_network'
|
||||
#require 'fog/vcloudng/requests/compute/get_network_ips'
|
||||
|
|
Loading…
Reference in a new issue