class Fog::AWS::ELB::Policies

Attributes

data[RW]
load_balancer[RW]

Public Instance Methods

all() click to toggle source
# File lib/fog/aws/models/elb/policies.rb, line 10
def all
  load(munged_data)
end
get(id) click to toggle source
# File lib/fog/aws/models/elb/policies.rb, line 14
def get(id)
  all.find{|policy| id == policy.id}
end

Private Instance Methods

munged_data() click to toggle source
# File lib/fog/aws/models/elb/policies.rb, line 19
def munged_data
  data.reduce([]){|m,e|
    policy_attribute_descriptions = e["PolicyAttributeDescriptions"]

    policy = {
      :id => e["PolicyName"],
      :type_name => e["PolicyTypeName"],
      :policy_attributes => policy_attributes(policy_attribute_descriptions)
    }

    case e["PolicyTypeName"]
    when 'AppCookieStickinessPolicyType'
      cookie_name = policy_attribute_descriptions.find{|h| h['AttributeName'] == 'CookieName'}['AttributeValue']
      policy['CookieName'] = cookie_name if cookie_name
    when 'LBCookieStickinessPolicyType'
      cookie_expiration_period = policy_attribute_descriptions.find{|h| h['AttributeName'] == 'CookieExpirationPeriod'}['AttributeValue'].to_i
      policy['CookieExpirationPeriod'] = cookie_expiration_period if cookie_expiration_period > 0
    end

    m << policy
    m
  }
end
policy_attributes(policy_attribute_descriptions) click to toggle source
# File lib/fog/aws/models/elb/policies.rb, line 43
def policy_attributes(policy_attribute_descriptions)
  policy_attribute_descriptions.reduce({}){|m,e|
    m[e["AttributeName"]] = e["AttributeValue"]
    m
  }
end