2013-03-01 18:46:56 -05:00
|
|
|
module Fog
|
|
|
|
module HP
|
2013-03-05 11:25:30 -05:00
|
|
|
class LB
|
2013-10-09 18:49:44 -04:00
|
|
|
|
|
|
|
# Delete an existing load balancer node
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * 'load_balancer_id'<~String> - UUId of load balancer for the node
|
|
|
|
# * 'node_id'<~String> - UUId of node to delete
|
|
|
|
#
|
2013-03-05 11:25:30 -05:00
|
|
|
class Real
|
2013-03-06 12:35:09 -05:00
|
|
|
|
2013-10-09 18:49:44 -04:00
|
|
|
def delete_load_balancer_node(load_balancer_id, node_id)
|
|
|
|
request(
|
|
|
|
:expects => 202,
|
2013-03-05 11:25:30 -05:00
|
|
|
:method => 'DELETE',
|
2013-10-09 18:49:44 -04:00
|
|
|
:path => "loadbalancers/#{load_balancer_id}/nodes/#{node_id}"
|
2013-03-05 11:25:30 -05:00
|
|
|
)
|
2013-03-01 18:46:56 -05:00
|
|
|
end
|
2013-03-05 11:25:30 -05:00
|
|
|
|
|
|
|
end
|
|
|
|
class Mock
|
2013-03-06 12:35:09 -05:00
|
|
|
|
2013-10-09 18:49:44 -04:00
|
|
|
def delete_load_balancer_node(load_balancer_id, node_id)
|
2013-03-06 18:35:05 -05:00
|
|
|
response = Excon::Response.new
|
2013-10-09 18:49:44 -04:00
|
|
|
if get_load_balancer(load_balancer_id)
|
|
|
|
if get_load_balancer_node(load_balancer_id, node_id)
|
2013-03-06 18:35:05 -05:00
|
|
|
response.status = 202
|
2013-10-09 18:49:44 -04:00
|
|
|
nodes = delete_node(load_balancer_id, node_id)
|
|
|
|
self.data[:lbs][load_balancer_id]['nodes'] = nodes
|
|
|
|
response
|
2013-03-06 18:35:05 -05:00
|
|
|
else
|
|
|
|
raise Fog::HP::LB::NotFound
|
|
|
|
end
|
|
|
|
else
|
|
|
|
raise Fog::HP::LB::NotFound
|
|
|
|
end
|
2013-03-01 18:46:56 -05:00
|
|
|
end
|
2013-03-06 18:35:05 -05:00
|
|
|
|
2013-10-09 18:49:44 -04:00
|
|
|
def delete_node(load_balancer_id, node_id)
|
|
|
|
nodes = list_load_balancer_nodes(load_balancer_id).body['nodes']
|
|
|
|
nodes.reject {|n| n['id'] == node_id}
|
2013-03-06 18:35:05 -05:00
|
|
|
end
|
2013-03-01 18:46:56 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-05-21 17:09:13 -04:00
|
|
|
end
|