diff --git a/lib/fog/hp/compute.rb b/lib/fog/hp/compute.rb index 8af813689..6e489b834 100644 --- a/lib/fog/hp/compute.rb +++ b/lib/fog/hp/compute.rb @@ -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 diff --git a/lib/fog/hp/requests/compute/associate_address.rb b/lib/fog/hp/requests/compute/associate_address.rb new file mode 100644 index 000000000..3597a8cca --- /dev/null +++ b/lib/fog/hp/requests/compute/associate_address.rb @@ -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 diff --git a/lib/fog/hp/requests/compute/disassociate_address.rb b/lib/fog/hp/requests/compute/disassociate_address.rb new file mode 100644 index 000000000..f00a109ae --- /dev/null +++ b/lib/fog/hp/requests/compute/disassociate_address.rb @@ -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