1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

end_point helpers

This commit is contained in:
Rodrigo Estebanez 2013-06-12 19:51:13 +02:00
parent aeae34e948
commit 79eedad51b
3 changed files with 14 additions and 4 deletions

View file

@ -34,6 +34,7 @@ module Fog
end
class Real
attr_reader :end_point
include Fog::Vcloudng::Shared::Real
include Fog::Vcloudng::Shared::Parser
@ -48,6 +49,7 @@ module Fog
@port = options[:port] || Fog::Vcloudng::Compute::Defaults::PORT
@scheme = options[:scheme] || Fog::Vcloudng::Compute::Defaults::SCHEME
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
@end_point = "#{@scheme}://#{@host}:#{@port}#{@path}/"
end
def default_vdc_id

View file

@ -31,16 +31,20 @@ module Fog
# 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)
def get_catalog_item(catalog_item_id)
request(
:expects => 200,
:headers => { 'Accept' => 'application/*+xml;version=1.5' },
:method => 'GET',
:parser => Fog::Parsers::Vcloudng::Compute::GetCatalogItem.new,
:path => "catalogItem/#{catalog_item_uuid}"
:path => "catalogItem/#{catalog_item_id}"
)
end
def catalog_item_end_point(catalog_item_id = nil)
end_point + ( catalog_item_id ? "catalogItem/#{catalog_item_id}" : "catalogItem" )
end
end
end
end

View file

@ -39,6 +39,10 @@ module Fog
)
end
def vdc_end_point(vdc_id = nil)
end_point + ( vdc_id ? "vdc/#{vdc_id}" : "vdc" )
end
end
end