mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[AWS|ELB] restore policy.cookie and policy.expiration methods
This commit is contained in:
parent
d15ba8e804
commit
429e4375ca
2 changed files with 17 additions and 2 deletions
|
@ -19,11 +19,24 @@ module Fog
|
|||
private
|
||||
def munged_data
|
||||
data.inject([]){|m,e|
|
||||
m << {
|
||||
policy_attribute_descriptions = e["PolicyAttributeDescriptions"]
|
||||
|
||||
policy = {
|
||||
:id => e["PolicyName"],
|
||||
:type_name => e["PolicyTypeName"],
|
||||
:policy_attributes => policy_attributes(e["PolicyAttributeDescriptions"])
|
||||
:policy_attributes => policy_attributes(policy_attribute_descriptions)
|
||||
}
|
||||
|
||||
case e["PolicyTypeName"]
|
||||
when 'AppCookieStickinessPolicyType'
|
||||
cookie_name = policy_attribute_descriptions.detect{|h| h['AttributeName'] == 'CookieName'}['AttributeValue']
|
||||
policy['CookieName'] = cookie_name if cookie_name
|
||||
when 'LBCookieStickinessPolicyType'
|
||||
cookie_expiration_period = policy_attribute_descriptions.detect{|h| h['AttributeName'] == 'CookieExpirationPeriod'}['AttributeValue'].to_i
|
||||
policy['CookieExpirationPeriod'] = cookie_expiration_period if cookie_expiration_period > 0
|
||||
end
|
||||
|
||||
m << policy
|
||||
m
|
||||
}
|
||||
end
|
||||
|
|
|
@ -250,6 +250,7 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|||
tests('create app policy') do
|
||||
elb.policies.create(:id => app_policy_id, :cookie => 'my-app-cookie', :cookie_stickiness => :app)
|
||||
returns(app_policy_id) { elb.policies.first.id }
|
||||
returns("my-app-cookie") { elb.policies.get(app_policy_id).cookie }
|
||||
end
|
||||
|
||||
tests('get policy') do
|
||||
|
@ -270,6 +271,7 @@ Shindo.tests('AWS::ELB | models', ['aws', 'elb']) do
|
|||
tests('setting a listener policy') do
|
||||
elb.set_listener_policy(80, lb_policy_id)
|
||||
returns([lb_policy_id]) { elb.listeners.get(80).policy_names }
|
||||
returns(600) { elb.policies.get(lb_policy_id).expiration }
|
||||
end
|
||||
|
||||
tests('unsetting a listener policy') do
|
||||
|
|
Loading…
Add table
Reference in a new issue