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

Enable and add associating and disassociating addresses to a server instance in the request layer for the compute service.

This commit is contained in:
Rupak Ganguly 2011-12-08 17:59:18 -05:00
parent d1f8355069
commit 6e2c3508eb
3 changed files with 62 additions and 0 deletions

View file

@ -24,6 +24,7 @@ module Fog
request_path 'fog/hp/requests/compute'
request :allocate_address
request :associate_address
request :change_password_server
#request :confirm_resized_server
request :create_image
@ -36,6 +37,7 @@ module Fog
request :delete_security_group
request :delete_security_group_rule
request :delete_server
request :disassociate_address
request :get_address
request :get_flavor_details
request :get_image_details

View file

@ -0,0 +1,30 @@
module Fog
module Compute
class HP
class Real
# Associate a floating IP address with existing server
#
# ==== Parameters
# * server_id<~Integer> - Id of server to associate IP with
# * ip_address<~String> - IP address to associate with the server
#
def associate_address(server_id, ip_address)
body = { 'addFloatingIp' => { 'server' => server_id, 'address' => ip_address }}
server_action(server_id, body)
end
end
class Mock
def associate_address(server_id, ip_address)
response = Excon::Response.new
response.status = 202
response
end
end
end
end
end

View file

@ -0,0 +1,30 @@
module Fog
module Compute
class HP
class Real
# Disassociate a floating IP address with existing server
#
# ==== Parameters
# * server_id<~Integer> - Id of server to associate IP with
# * ip_address<~String> - IP address to associate with the server
#
def disassociate_address(server_id, ip_address)
body = { 'removeFloatingIp' => { 'server' => server_id, 'address' => ip_address }}
server_action(server_id, body)
end
end
class Mock
def disassociate_address(server_id, ip_address)
response = Excon::Response.new
response.status = 202
response
end
end
end
end
end