class AWS::ELB::LoadBalancerPolicy

Attributes

load_balancer[R]

@return [LoadBalancer] Returns the load balancer this policy belongs to.

Public Class Methods

new(load_balancer, name, options = {}) click to toggle source

@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

Public Instance Methods

attributes() click to toggle source

@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
delete() click to toggle source

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
exists?() click to toggle source

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

Protected Instance Methods

get_resource(attr_name = nil) click to toggle source
# 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
resource_identifiers() click to toggle source
# File lib/aws/elb/load_balancer_policy.rb, line 81
def resource_identifiers
  [[:load_balancer_name, load_balancer.name],[:policy_name, name]]
end