mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|elb] Add requests for creating cookie policies.
Adds ELB#create_app_cookie_stickiness_policy and ELB#create_lb_cookie_stickiness_policy
This commit is contained in:
parent
c4380405e3
commit
9d1c9f5619
4 changed files with 86 additions and 3 deletions
|
@ -7,8 +7,8 @@ module Fog
|
||||||
|
|
||||||
request_path 'fog/aws/requests/elb'
|
request_path 'fog/aws/requests/elb'
|
||||||
request :configure_health_check
|
request :configure_health_check
|
||||||
#request :create_app_cookie_stickiness_policy
|
request :create_app_cookie_stickiness_policy
|
||||||
#request :create_db_cookie_stickiness_policy
|
request :create_lb_cookie_stickiness_policy
|
||||||
request :create_load_balancer
|
request :create_load_balancer
|
||||||
request :create_load_balancer_listeners
|
request :create_load_balancer_listeners
|
||||||
request :delete_load_balancer
|
request :delete_load_balancer
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
module Fog
|
||||||
|
module AWS
|
||||||
|
class ELB
|
||||||
|
class Real
|
||||||
|
|
||||||
|
require 'fog/aws/parsers/elb/empty'
|
||||||
|
|
||||||
|
# Create an app cookie stickiness policy
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * lb_name<~String> - Name of the ELB
|
||||||
|
# * policy_name<~String> - The name of the policy being created.
|
||||||
|
# The name must be unique within the set of policies for this Load Balancer.
|
||||||
|
# * cookie_name<~String> - Name of the application cookie used for stickiness.
|
||||||
|
# ==== Returns
|
||||||
|
# * response<~Excon::Response>:
|
||||||
|
# * body<~Hash>:
|
||||||
|
# * 'ResponseMetadata'<~Hash>:
|
||||||
|
# * 'RequestId'<~String> - Id of request
|
||||||
|
def create_app_cookie_stickiness_policy(lb_name, policy_name, cookie_name)
|
||||||
|
params = {'CookieName' => cookie_name, 'PolicyName' => policy_name}
|
||||||
|
|
||||||
|
request({
|
||||||
|
'Action' => 'CreateAppCookieStickinessPolicy',
|
||||||
|
'LoadBalancerName' => lb_name,
|
||||||
|
:parser => Fog::Parsers::AWS::ELB::Empty.new
|
||||||
|
}.merge!(params))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,35 @@
|
||||||
|
module Fog
|
||||||
|
module AWS
|
||||||
|
class ELB
|
||||||
|
class Real
|
||||||
|
|
||||||
|
require 'fog/aws/parsers/elb/empty'
|
||||||
|
|
||||||
|
# Create a Load Balancer Cookie Stickiness Policy
|
||||||
|
#
|
||||||
|
# ==== Parameters
|
||||||
|
# * lb_name<~String> - Name of the ELB
|
||||||
|
# * policy_name<~String> - The name of the policy being created. The name
|
||||||
|
# must be unique within the set of policies for this Load Balancer.
|
||||||
|
# * cookie_expiration_period<~Integer> - The time period in seconds after
|
||||||
|
# which the cookie should be considered stale. Not specifying this
|
||||||
|
# parameter indicates that the sticky session will last for the duration of the browser session.
|
||||||
|
# ==== Returns
|
||||||
|
# * response<~Excon::Response>:
|
||||||
|
# * body<~Hash>:
|
||||||
|
# * 'ResponseMetadata'<~Hash>:
|
||||||
|
# * 'RequestId'<~String> - Id of request
|
||||||
|
def create_lb_cookie_stickiness_policy(lb_name, policy_name, cookie_expiration_period=nil)
|
||||||
|
params = {'PolicyName' => policy_name, 'CookieExpirationPeriod' => cookie_expiration_period}
|
||||||
|
|
||||||
|
request({
|
||||||
|
'Action' => 'CreateLBCookieStickinessPolicy',
|
||||||
|
'LoadBalancerName' => lb_name,
|
||||||
|
:parser => Fog::Parsers::AWS::ELB::Empty.new
|
||||||
|
}.merge!(params))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -26,6 +26,22 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
||||||
AWS[:elb].configure_health_check(@load_balancer_id, health_check).body
|
AWS[:elb].configure_health_check(@load_balancer_id, health_check).body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tests("#create_app_cookie_stickiness_policy").formats(AWS::ELB::Formats::BASIC) do
|
||||||
|
cookie, policy = 'fog-app-cookie', 'fog-app-policy'
|
||||||
|
AWS[:elb].create_app_cookie_stickiness_policy(@load_balancer_id, policy, cookie).body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#create_lb_cookie_stickiness_policy with expiry").formats(AWS::ELB::Formats::BASIC) do
|
||||||
|
policy = 'fog-lb-expiry'
|
||||||
|
expiry = 300
|
||||||
|
AWS[:elb].create_lb_cookie_stickiness_policy(@load_balancer_id, policy, expiry).body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#create_lb_cookie_stickiness_policy without expiry").formats(AWS::ELB::Formats::BASIC) do
|
||||||
|
policy = 'fog-lb-no-expiry'
|
||||||
|
AWS[:elb].create_lb_cookie_stickiness_policy(@load_balancer_id, policy).body
|
||||||
|
end
|
||||||
|
|
||||||
tests("#create_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
|
tests("#create_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
|
||||||
listeners = [
|
listeners = [
|
||||||
{'Protocol' => 'tcp', 'LoadBalancerPort' => 443, 'InstancePort' => 443},
|
{'Protocol' => 'tcp', 'LoadBalancerPort' => 443, 'InstancePort' => 443},
|
||||||
|
@ -39,7 +55,6 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
||||||
AWS[:elb].delete_load_balancer_listeners(@load_balancer_id, ports).body
|
AWS[:elb].delete_load_balancer_listeners(@load_balancer_id, ports).body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
tests("#delete_load_balancer").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
tests("#delete_load_balancer").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
||||||
AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue