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

[vcloud_director] get_edge_gateways -> get_org_vdc_networks

This commit is contained in:
Nick Osborn 2013-10-13 09:47:37 +01:00
parent a796788ef1
commit dbfd59c74c
4 changed files with 28 additions and 27 deletions

View file

@ -104,7 +104,6 @@ module Fog
request :get_disks_from_query
request :get_disks_rasd_items_list
request :get_edge_gateway
request :get_edge_gateways
request :get_entity
request :get_guest_customization_system_section_vapp
request :get_guest_customization_system_section_vapp_template
@ -130,6 +129,7 @@ module Fog
request :get_network_section_vapp
request :get_network_section_vapp_template
request :get_operating_system_section
request :get_org_vdc_gateways
request :get_organization
request :get_organization_metadata
request :get_organization_metadata_item_metadata

View file

@ -2,9 +2,9 @@ module Fog
module Compute
class VcloudDirector
class Real
# Retrieve an edge gateway
# Retrieve an edge gateway.
#
# @param [String] id Object identifier of the Edge Gateway
# @param [String] id Object identifier of the edge gateway.
# @return [Excon::Response]
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-EdgeGateway.html
@ -28,7 +28,6 @@ module Fog
response.status = 400
raise Excon::Errors.status_error({:expects => 200}, response)
end
unless edge_gateway = data[:edge_gateways][id]
response.status = 403
raise Excon::Errors.status_error({:expects => 200}, response)
@ -59,20 +58,19 @@ module Fog
:href => make_href("admin/edgeGateway/#{id}/action/syncSyslogServerSettings")}],
:Description => "vCloud CI (nft00052i2)",
:Configuration =>
{:GatewayBackingConfig => "compact",
:GatewayInterfaces =>
{:GatewayInterface => []},
:EdgeGatewayServiceConfiguration =>
{:FirewallService =>
{:IsEnabled => "true",
:DefaultAction => "drop",
:LogDefaultAction => "false"},
:NatService => {:IsEnabled => "true"}},
:HaEnabled => "false",
:UseDefaultRouteForDnsRelay => "false"}}
{:GatewayBackingConfig => "compact",
:GatewayInterfaces =>
{:GatewayInterface => []},
:EdgeGatewayServiceConfiguration =>
{:FirewallService =>
{:IsEnabled => "true",
:DefaultAction => "drop",
:LogDefaultAction => "false"},
:NatService => {:IsEnabled => "true"}},
:HaEnabled => "false",
:UseDefaultRouteForDnsRelay => "false"}}
body[:Configuration][:GatewayInterfaces][:GatewayInterface] += edge_gateway[:networks].map do |network|
extras = {
:Network => {
:type => "application/vnd.vmware.admin.network+xml",
@ -82,7 +80,6 @@ module Fog
:Name => data[:networks][network][:name],
:DisplayName => data[:networks][network][:name]
}
data[:networks][network].merge extras
end

View file

@ -2,26 +2,30 @@ module Fog
module Compute
class VcloudDirector
class Real
extend Fog::Deprecation
deprecate :get_edge_gateways, :get_org_vdc_gateways
# List all gateways for this Org vDC.
#
# @param [String] vdc_id Object identifier of the VDC
# @param [String] id Object identifier of the vDC.
# @return [Excon::Response]
# * body<~Hash>:
# @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-OrgVdcGateways.html
# vCloud API Documentation
# @since vCloud API version 5.1
def get_edge_gateways(vdc_id)
def get_org_vdc_gateways(id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "admin/vdc/#{vdc_id}/edgeGateways"
:expects => 200,
:idempotent => true,
:method => 'GET',
:parser => Fog::ToHashDocument.new,
:path => "admin/vdc/#{id}/edgeGateways"
)
end
end
class Mock
def get_edge_gateways(vdc_id)
def get_org_vdc_gateways(vdc_id)
response = Excon::Response.new
unless valid_uuid?(vdc_id)

View file

@ -10,9 +10,9 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector
@vdc_id = link[:href].split('/').last
end
tests('#get_edge_gateways').data_matches_schema(VcloudDirector::Compute::Schema::QUERY_RESULT_RECORDS_TYPE) do
tests('#get_org_vdc_gateways').data_matches_schema(VcloudDirector::Compute::Schema::QUERY_RESULT_RECORDS_TYPE) do
begin
@edge_gateways = @service.get_edge_gateways(@vdc_id).body
@edge_gateways = @service.get_org_vdc_gateways(@vdc_id).body
rescue Excon::Errors::Unauthorized # bug, may be localised
retry
end