1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vcloud/terremark/ecloud/requests/get_public_ips.rb

42 lines
1.1 KiB
Ruby
Raw Normal View History

2010-05-28 05:17:59 +08:00
module Fog
class Vcloud
2010-05-28 05:17:59 +08:00
module Terremark
class Ecloud
2010-05-28 05:17:59 +08:00
class Real
basic_request :get_public_ips
2010-05-28 05:17:59 +08:00
end
class Mock
2010-05-28 05:17:59 +08:00
#
# Based off of:
# http://support.theenterprisecloud.com/kb/default.asp?id=577&Lang=1&SID=
2010-05-28 05:17:59 +08:00
#
2010-05-28 05:17:59 +08:00
def get_public_ips(public_ips_uri)
public_ips_uri = ensure_unparsed(public_ips_uri)
if public_ip_collection = mock_data.public_ip_collection_from_href(public_ips_uri)
2010-05-28 05:17:59 +08:00
xml = Builder::XmlMarkup.new
mock_it 200,
2010-05-28 05:17:59 +08:00
xml.PublicIPAddresses {
public_ip_collection.items.each do |ip|
2010-05-28 05:17:59 +08:00
xml.PublicIPAddress {
xml.Id ip.object_id
xml.Href ip.href
xml.Name ip.name
2010-05-28 05:17:59 +08:00
}
end
}, { 'Content-Type' => 'application/vnd.tmrk.ecloud.publicIpsList+xml'}
else
mock_error 200, "401 Unauthorized"
end
end
end
end
end
end
end