mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Enable and implement get address for request layer along with mocking support for the compute service.
This commit is contained in:
parent
ee09f5709b
commit
408bec0b00
2 changed files with 46 additions and 0 deletions
|
@ -34,6 +34,7 @@ module Fog
|
|||
request :delete_security_group
|
||||
request :delete_security_group_rule
|
||||
request :delete_server
|
||||
request :get_address
|
||||
request :get_flavor_details
|
||||
request :get_image_details
|
||||
request :get_security_group
|
||||
|
|
45
lib/fog/hp/requests/compute/get_address.rb
Normal file
45
lib/fog/hp/requests/compute/get_address.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class HP
|
||||
class Real
|
||||
|
||||
# Get details about an existing floating IP address
|
||||
#
|
||||
# ==== Parameters
|
||||
# * 'address_id'<~Integer> - Id of floating IP address get details for
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'floating_ip'<~Hash> -
|
||||
# * 'id'<~Integer> - Id of the address
|
||||
# * 'ip'<~String> - Floating IP of the address
|
||||
# * 'instance_id'<~String> - Id of the associated server instance
|
||||
# * 'fixed_ip'<~String> - Fixed IP of the address
|
||||
def get_address(address_id)
|
||||
request(
|
||||
:expects => [200],
|
||||
:method => 'GET',
|
||||
:path => "os-floating-ips/#{address_id}"
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def get_address(address_id)
|
||||
response = Excon::Response.new
|
||||
if address = self.data[:addresses][address_id]
|
||||
response.status = 200
|
||||
response.body = { 'floating_ip' => address }
|
||||
response
|
||||
else
|
||||
raise Fog::Compute::HP::NotFound
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue