Class: AWS::ELB::LoadBalancerPolicy
- Inherits:
-
Core::Resource
- Object
- Core::Resource
- AWS::ELB::LoadBalancerPolicy
- Defined in:
- lib/aws/elb/load_balancer_policy.rb
Instance Attribute Summary collapse
-
#load_balancer ⇒ LoadBalancer
readonly
Returns the load balancer this policy belongs to.
Instance Method Summary collapse
-
#attributes ⇒ Hash
Returns a hash of policy attributes.
-
#delete ⇒ nil
Deletes this load balancer policy.
-
#exists? ⇒ Boolean
Useful for determining if a policy with the given name exists:.
Instance Attribute Details
#load_balancer ⇒ LoadBalancer (readonly)
Returns the load balancer this policy belongs to.
25 26 27 |
# File 'lib/aws/elb/load_balancer_policy.rb', line 25 def load_balancer @load_balancer end |
Instance Method Details
#attributes ⇒ Hash
Returns a hash of policy attributes. Keys are policy attribute names, and values are arrays one or more policy attribute values.
46 47 48 49 50 51 52 53 |
# 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 ⇒ nil
Deletes this load balancer policy.
57 58 59 60 61 62 63 64 65 |
# 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? ⇒ Boolean
Useful for determining if a policy with the given name exists:
load_balancer.policies['my-policy-name'].exists? # => true/false
73 74 75 76 77 78 |
# 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 |