2013-03-01 18:46:56 -05:00
|
|
|
module Fog
|
|
|
|
module HP
|
|
|
|
class BlockStorage
|
|
|
|
class LB
|
|
|
|
class Real
|
2013-03-04 15:33:54 -05:00
|
|
|
def create_load_balancer(name,nodes,options={})
|
|
|
|
#required
|
|
|
|
# name
|
|
|
|
#at least one node
|
|
|
|
data = {
|
|
|
|
"name" => name,
|
|
|
|
"nodes" => nodes
|
|
|
|
}
|
2013-03-01 18:46:56 -05:00
|
|
|
|
2013-03-04 15:33:54 -05:00
|
|
|
if options['port']
|
|
|
|
data['port'] = options['port']
|
|
|
|
end
|
|
|
|
|
|
|
|
if options['protocol']
|
|
|
|
data['protocol'] = options['protocol']
|
|
|
|
end
|
|
|
|
|
|
|
|
if options['virtualIps']
|
|
|
|
data['virtualIps'] = []
|
|
|
|
for vip in options['virtualIps']
|
|
|
|
data['virtualIps'] << vip
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
response = request(
|
|
|
|
:body => Fog::JSON.encode(data),
|
|
|
|
:expects => 200,
|
|
|
|
:method => 'POST',
|
|
|
|
:path => "loadbalancers/#{load_balancer_id}"
|
|
|
|
)
|
|
|
|
response
|
|
|
|
|
|
|
|
end
|
2013-03-01 18:46:56 -05:00
|
|
|
end
|
|
|
|
class Mock
|
2013-03-04 15:33:54 -05:00
|
|
|
def create_load_balancer(name,nodes, options={})
|
|
|
|
response = Excon::Response.new
|
|
|
|
|
2013-03-01 18:46:56 -05:00
|
|
|
|
2013-03-04 15:33:54 -05:00
|
|
|
response
|
|
|
|
end
|
2013-03-01 18:46:56 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|