2011-07-27 21:12:46 -04:00
|
|
|
module Fog
|
|
|
|
module Rackspace
|
2011-08-04 17:21:22 -04:00
|
|
|
class LoadBalancers
|
2011-07-27 21:12:46 -04:00
|
|
|
class Real
|
|
|
|
def set_monitor(load_balancer_id, type, delay, timeout, attempsBeforeDeactivation, options = {})
|
|
|
|
data = {
|
|
|
|
'type' => type,
|
|
|
|
'delay' => delay,
|
|
|
|
'timeout' => timeout,
|
|
|
|
'attemptsBeforeDeactivation' => attempsBeforeDeactivation
|
|
|
|
}
|
|
|
|
if options.has_key? :path
|
|
|
|
data['path'] = options[:path]
|
|
|
|
end
|
|
|
|
if options.has_key? :body_regex
|
|
|
|
data['bodyRegex'] = options[:body_regex]
|
|
|
|
end
|
|
|
|
if options.has_key? :status_regex
|
|
|
|
data['statusRegex'] = options[:status_regex]
|
|
|
|
end
|
|
|
|
request(
|
2012-04-25 10:31:28 -04:00
|
|
|
:body => Fog::JSON.encode(data),
|
2011-07-27 21:12:46 -04:00
|
|
|
:expects => [200, 202],
|
|
|
|
:path => "loadbalancers/#{load_balancer_id}/healthmonitor",
|
|
|
|
:method => 'PUT'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|