@return [LoadBalancer] Returns the load balancer this policy belongs to.
@private
# File lib/aws/elb/load_balancer_policy.rb, line 19 def initialize load_balancer, name, options = {} @load_balancer = load_balancer super(load_balancer, options.merge(:name => name.to_s)) end
@return [Hash] Returns a hash of policy attributes. Keys are
policy attribute names, and values are arrays one or more policy attribute values.
# File lib/aws/elb/load_balancer_policy.rb, line 46 def attributes attributes = {} policy_attribute_descriptions.each do |desc| attributes[desc.attribute_name] ||= [] attributes[desc.attribute_name] << desc.attribute_value end attributes end
Deletes this load balancer policy. @return [nil]
# File lib/aws/elb/load_balancer_policy.rb, line 57 def delete client.delete_load_balancer_policy( :load_balancer_name => load_balancer.name, :policy_name => name) nil end
Useful for determining if a policy with the given name exists:
load_balancer.policies['my-policy-name'].exists? # => true/false
@return [Boolean] Returns true this policy’s load balancer has a
policy with this name.
# File lib/aws/elb/load_balancer_policy.rb, line 73 def exists? r = get_resource r.policy_descriptions.find{|d| d.policy_name == name } ? true : false rescue AWS::ELB::Errors::LoadBalancerNotFound false end
# File lib/aws/elb/load_balancer_policy.rb, line 86 def get_resource attr_name = nil client.describe_load_balancer_policies( :load_balancer_name => load_balancer.name) end
# File lib/aws/elb/load_balancer_policy.rb, line 81 def resource_identifiers [[:load_balancer_name, load_balancer.name],[:policy_name, name]] end