1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/hp/requests/lb/create_load_balancer.rb
2013-10-30 19:01:58 -04:00

49 lines
No EOL
1 KiB
Ruby

module Fog
module HP
class LB
class Real
def create_load_balancer(name, nodes, options={})
#required
# name
#at least one node
data = {
"name" => name,
"nodes" => nodes
}
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
end
class Mock
def create_load_balancer(name, nodes, options={})
response = Excon::Response.new
response
end
end
end
end
end