mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|elb] Add request ELB#set_load_balancer_policies_of_listener
This commit is contained in:
parent
c8f78976b7
commit
0ed4fd7f11
3 changed files with 55 additions and 1 deletions
|
@ -21,7 +21,7 @@ module Fog
|
||||||
request :enable_availability_zones_for_load_balancer
|
request :enable_availability_zones_for_load_balancer
|
||||||
request :register_instances_with_load_balancer
|
request :register_instances_with_load_balancer
|
||||||
#request :set_load_balancer_listener_ssl_certificate
|
#request :set_load_balancer_listener_ssl_certificate
|
||||||
#request :set_load_balancer_policies_of_listener
|
request :set_load_balancer_policies_of_listener
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
module Fog
|
||||||
|
module AWS
|
||||||
|
class ELB
|
||||||
|
class Real
|
||||||
|
|
||||||
|
require 'fog/aws/parsers/elb/empty'
|
||||||
|
|
||||||
|
# Associates, updates, or disables a policy with a listener on the
|
||||||
|
# load balancer. Currently only zero (0) or one (1) policy can be
|
||||||
|
# associated with a listener.
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * lb_name<~String> - Name of the ELB
|
||||||
|
# * load_balancer_port<~Integer> - The external port of the LoadBalancer
|
||||||
|
# with which this policy has to be associated.
|
||||||
|
|
||||||
|
# * policy_names<~Array> - List of policies to be associated with the
|
||||||
|
# listener. Currently this list can have at most one policy. If the
|
||||||
|
# list is empty, the current policy is removed from the listener.
|
||||||
|
# ==== Returns
|
||||||
|
# * response<~Excon::Response>:
|
||||||
|
# * body<~Hash>:
|
||||||
|
# * 'ResponseMetadata'<~Hash>:
|
||||||
|
# * 'RequestId'<~String> - Id of request
|
||||||
|
def set_load_balancer_policies_of_listener(lb_name, load_balancer_port, policy_names)
|
||||||
|
params = {'LoadBalancerPort' => load_balancer_port}
|
||||||
|
if policy_names.any?
|
||||||
|
params.merge!(AWS.indexed_param('PolicyNames.member', policy_names))
|
||||||
|
else
|
||||||
|
params['PolicyNames'] = ''
|
||||||
|
end
|
||||||
|
|
||||||
|
request({
|
||||||
|
'Action' => 'SetLoadBalancerPoliciesOfListener',
|
||||||
|
'LoadBalancerName' => lb_name,
|
||||||
|
:parser => Fog::Parsers::AWS::ELB::Empty.new
|
||||||
|
}.merge!(params))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -55,6 +55,17 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
||||||
AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
AWS[:elb].create_load_balancer_listeners(@load_balancer_id, listeners).body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tests("#set_load_balancer_policies_of_listener adds policy").formats(AWS::ELB::Formats::BASIC) do
|
||||||
|
port, policies = 80, ['fog-lb-expiry']
|
||||||
|
body = AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, policies).body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#set_load_balancer_policies_of_listener removes policy").formats(AWS::ELB::Formats::BASIC) do
|
||||||
|
port = 80
|
||||||
|
body = AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, []).body
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
tests("#delete_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
|
tests("#delete_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
|
||||||
ports = [80, 443]
|
ports = [80, 443]
|
||||||
AWS[:elb].delete_load_balancer_listeners(@load_balancer_id, ports).body
|
AWS[:elb].delete_load_balancer_listeners(@load_balancer_id, ports).body
|
||||||
|
|
Loading…
Reference in a new issue