1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/aws/models/elb/policies.rb

43 lines
894 B
Ruby
Raw Normal View History

require 'fog/aws/models/elb/policy'
module Fog
module AWS
class ELB
class Policies < Fog::Collection
model Fog::AWS::ELB::Policy
attr_accessor :data, :load_balancer
def all
load(munged_data)
end
def get(id)
all.detect{|policy| id == policy.id}
end
private
def munged_data
data.inject([]){|m,e|
m << {
:id => e["PolicyName"],
:type_name => e["PolicyTypeName"],
:policy_attributes => policy_attributes(e["PolicyAttributeDescriptions"])
}
m
}
end
def policy_attributes(policy_attribute_descriptions)
policy_attribute_descriptions.inject({}){|m,e|
m[e["AttributeName"]] = e["AttributeValue"]
m
}
end
end
end
end
end