mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
get_vapp_template implemented
This commit is contained in:
parent
c1385081a9
commit
98914133d4
3 changed files with 88 additions and 2 deletions
36
lib/fog/vcloudng/parsers/compute/get_vapp_template.rb
Normal file
36
lib/fog/vcloudng/parsers/compute/get_vapp_template.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module Vcloudng
|
||||
module Compute
|
||||
|
||||
|
||||
class GetVappTemplate < VcloudngParser
|
||||
|
||||
def reset
|
||||
@response = { 'Links' => [] }
|
||||
end
|
||||
|
||||
def start_element(name, attributes)
|
||||
super
|
||||
case name
|
||||
when 'Link'
|
||||
link = extract_attributes(attributes)
|
||||
@response['Links'] << link
|
||||
when 'VAppTemplate'
|
||||
vapp_template = extract_attributes(attributes)
|
||||
@response['name'] = vapp_template['name']
|
||||
end
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
if name == 'Description'
|
||||
@response['Description'] = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
51
lib/fog/vcloudng/requests/compute/get_vapp_template.rb
Normal file
51
lib/fog/vcloudng/requests/compute/get_vapp_template.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
module Fog
|
||||
module Vcloudng
|
||||
module Compute
|
||||
class Real
|
||||
|
||||
require 'fog/vcloudng/parsers/compute/get_vapp_template'
|
||||
|
||||
# Get details of a vapp template
|
||||
#
|
||||
# ==== Parameters
|
||||
# * vapp_template_id<~Integer> - Id of vapp template 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
|
||||
# catalog_item = vcloud.get_catalog_item(catalog_item_uuid)
|
||||
# vapp_template_uuid = catalog_item.body["Entity"]["href"].split('/').last
|
||||
# vcloud.get_vapp_template(vapp_template_uuid)
|
||||
#
|
||||
def get_vapp_template(vapp_template_uuid)
|
||||
request(
|
||||
:expects => 200,
|
||||
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
|
||||
:method => 'GET',
|
||||
:parser => Fog::Parsers::Vcloudng::Compute::GetVappTemplate.new,
|
||||
:path => "vAppTemplate/#{vapp_template_uuid}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -258,7 +258,6 @@ module Fog
|
|||
#require 'fog/vcloudng/parsers/compute/get_public_ips'
|
||||
#require 'fog/vcloudng/parsers/compute/get_tasks_list'
|
||||
#require 'fog/vcloudng/parsers/compute/get_keys_list'
|
||||
#require 'fog/vcloudng/parsers/compute/get_vapp_template'
|
||||
#require 'fog/vcloudng/parsers/compute/get_vdc'
|
||||
#require 'fog/vcloudng/parsers/compute/instantiate_vapp_template'
|
||||
#require 'fog/vcloudng/parsers/compute/internet_service'
|
||||
|
@ -289,7 +288,7 @@ module Fog
|
|||
#require 'fog/vcloudng/requests/compute/get_tasks_list'
|
||||
#require 'fog/vcloudng/requests/compute/get_keys_list'
|
||||
#require 'fog/vcloudng/requests/compute/get_vapp'
|
||||
#require 'fog/vcloudng/requests/compute/get_vapp_template'
|
||||
require 'fog/vcloudng/requests/compute/get_vapp_template'
|
||||
#require 'fog/vcloudng/requests/compute/get_vdc'
|
||||
#require 'fog/vcloudng/requests/compute/instantiate_vapp_template'
|
||||
#require 'fog/vcloudng/requests/compute/configure_vapp'
|
||||
|
|
Loading…
Reference in a new issue