Class: AWS::ELB::LoadBalancerPolicyCollection

Inherits:
Object
  • Object
show all
Includes:
Core::Collection::Simple
Defined in:
lib/aws/elb/load_balancer_policy_collection.rb

Instance Attribute Summary collapse

Attributes included from Core::Model

#config

Instance Method Summary collapse

Methods included from Core::Collection::Simple

#each_batch

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Methods included from Core::Model

#client, #config_prefix, #inspect

Constructor Details

#initialize(load_balancer, options = {}) ⇒ LoadBalancerPolicyCollection

Returns a new instance of LoadBalancerPolicyCollection.



21
22
23
24
# File 'lib/aws/elb/load_balancer_policy_collection.rb', line 21

def initialize load_balancer, options = {}
  @load_balancer = load_balancer
  super
end

Instance Attribute Details

#load_balancerObject (readonly)

Returns the value of attribute load_balancer.



26
27
28
# File 'lib/aws/elb/load_balancer_policy_collection.rb', line 26

def load_balancer
  @load_balancer
end

Instance Method Details

#[](policy_name) ⇒ LoadBalancerPolicy

Returns a reference to the load balancer policy with the given name.

Parameters:

  • policy_name (String)

    The name of the policy to return.

Returns:

  • (LoadBalancerPolicy)

    Returns a reference to the load balancer policy with the given name.



184
185
186
# File 'lib/aws/elb/load_balancer_policy_collection.rb', line 184

def [] policy_name
  LoadBalancerPolicy.new(load_balancer, policy_name)
end

#create(name, type, attributes = {}) ⇒ nil

Creates a new load balancer policy that contains the necessary attributes depending on the policy type. Policies are settings that are saved for your load balancer and that can be applied to the front-end listener, or the back-end application server, depending on your policy type.

Applying Policies

To apply a policy to a front-end listener:

# each listener may only have a single policy
load_balancer.listener[80].policy = listener_policy

To apply a policy to backend instance port

# back end servers can have multiple policies per instance port
load_balancer.backend_server_policies.add(80, back_end_policy)

Parameters:

  • name (String)

    The name of the policy being created. The name must be unique within the set of policies for this load balancer.

  • type (String)

    The policy type name. Valid values inlucde:

    • ‘PublicKeyPolicyType’

    • ‘AppCookieStickinessPolicyType’

    • ‘LBCookieStickinessPolicyType’

    • ‘SSLNegotiationPolicyType’

    • ‘BackendServerAuthenticationPolicyType’

  • attributes (Hash) (defaults to: {})

    A hash of policy attributes. Each policy type accepts a different list of hash options. Below each policy type name is listed with its list of accepted options. Attributes that accept more than one value should be provided as an array of values.

    Hash keys should be attribute names, values may be single values or arrays of values.

    PublicKeyPolicyType

    Policy containing a list of public keys to accept when authenticating the back-end server(s). This policy cannot be applied directly to back-end servers or listeners but must be part of a BackendServerAuthenticationPolicyType.
    
    * 'PublicKey', String, one
    

    AppCookieStickinessPolicyType

    Stickiness policy with session lifetimes controlled by the lifetime of the application-generated cookie. This policy can be associated only with HTTP/HTTPS listeners.
    
    * 'CookieName', String, one
    

    LBCookieStickinessPolicyType

    Stickiness policy with session lifetimes controlled by the browser (user-agent) or a specified expiration period. This policy can be associated only with HTTP/HTTPS listeners.
    
    * 'CookieExpirationPeriod', Long, zero or one
    

    SSLNegotiationPolicyType

    Listener policy that defines the ciphers and protocols that will be accepted by the load balancer. This policy can be associated only with HTTPS/SSL listeners.
    
    * 'Protocol-SSLv2', Boolean, zero or one
    * 'Protocol-TLSv1', Boolean, zero or one
    * 'Protocol-SSLv3', Boolean, zero or one
    * 'DHE-RSA-AES256-SHA', Boolean, zero or one
    * 'DHE-DSS-AES256-SHA', Boolean, zero or one
    * 'DHE-RSA-CAMELLIA256-SHA', Boolean, zero or one
    * 'DHE-DSS-CAMELLIA256-SHA', Boolean, zero or one
    * 'ADH-AES256-SHA', Boolean, zero or one
    * 'ADH-CAMELLIA256-SHA', Boolean, zero or one
    * 'AES256-SHA', Boolean, zero or one
    * 'CAMELLIA256-SHA', Boolean, zero or one
    * 'PSK-AES256-CBC-SHA', Boolean, zero or one
    * 'EDH-RSA-DES-CBC3-SHA', Boolean, zero or one
    * 'EDH-DSS-DES-CBC3-SHA', Boolean, zero or one
    * 'ADH-DES-CBC3-SHA', Boolean, zero or one
    * 'DES-CBC3-SHA', Boolean, zero or one
    * 'DES-CBC3-MD5', Boolean, zero or one
    * 'PSK-3DES-EDE-CBC-SHA', Boolean, zero or one
    * 'KRB5-DES-CBC3-SHA', Boolean, zero or one
    * 'KRB5-DES-CBC3-MD5', Boolean, zero or one
    * 'DHE-RSA-AES128-SHA', Boolean, zero or one
    * 'DHE-DSS-AES128-SHA', Boolean, zero or one
    * 'DHE-RSA-SEED-SHA', Boolean, zero or one
    * 'DHE-DSS-SEED-SHA', Boolean, zero or one
    * 'DHE-RSA-CAMELLIA128-SHA', Boolean, zero or one
    * 'DHE-DSS-CAMELLIA128-SHA', Boolean, zero or one
    * 'ADH-AES128-SHA', Boolean, zero or one
    * 'ADH-SEED-SHA', Boolean, zero or one
    * 'ADH-CAMELLIA128-SHA', Boolean, zero or one
    * 'AES128-SHA', Boolean, zero or one
    * 'SEED-SHA', Boolean, zero or one
    * 'CAMELLIA128-SHA', Boolean, zero or one
    * 'RC2-CBC-MD5', Boolean, zero or one
    * 'PSK-AES128-CBC-SHA', Boolean, zero or one
    * 'ADH-RC4-MD5', Boolean, zero or one
    * 'IDEA-CBC-SHA', Boolean, zero or one
    * 'RC4-SHA', Boolean, zero or one
    * 'RC4-MD5', Boolean, zero or one
    * 'PSK-RC4-SHA', Boolean, zero or one
    * 'KRB5-RC4-SHA', Boolean, zero or one
    * 'KRB5-RC4-MD5', Boolean, zero or one
    * 'EDH-RSA-DES-CBC-SHA', Boolean, zero or one
    * 'EDH-DSS-DES-CBC-SHA', Boolean, zero or one
    * 'ADH-DES-CBC-SHA', Boolean, zero or one
    * 'DES-CBC-SHA', Boolean, zero or one
    * 'DES-CBC-MD5', Boolean, zero or one
    * 'KRB5-DES-CBC-SHA', Boolean, zero or one
    * 'KRB5-DES-CBC-MD5', Boolean, zero or one
    * 'EXP-EDH-RSA-DES-CBC-SHA', Boolean, zero or one
    * 'EXP-EDH-DSS-DES-CBC-SHA', Boolean, zero or one
    * 'EXP-ADH-DES-CBC-SHA', Boolean, zero or one
    * 'EXP-DES-CBC-SHA', Boolean, zero or one
    * 'EXP-RC2-CBC-MD5', Boolean, zero or one
    * 'EXP-KRB5-RC2-CBC-SHA', Boolean, zero or one
    * 'EXP-KRB5-DES-CBC-SHA', Boolean, zero or one
    * 'EXP-KRB5-RC2-CBC-MD5', Boolean, zero or one
    * 'EXP-KRB5-DES-CBC-MD5', Boolean, zero or one
    * 'EXP-ADH-RC4-MD5', Boolean, zero or one
    * 'EXP-RC4-MD5', Boolean, zero or one
    * 'EXP-KRB5-RC4-SHA', Boolean, zero or one
    * 'EXP-KRB5-RC4-MD5', Boolean, zero or one
    

    BackendServerAuthenticationPolicyType

    Policy that controls authentication to back-end server(s) and contains one or more policies, such as an instance of a PublicKeyPolicyType. This policy can be associated only with back-end servers that are using HTTPS/SSL.
    
    * 'PublicKeyPolicyName', PolicyName, one or more
    

Returns:

  • (nil)


158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/aws/elb/load_balancer_policy_collection.rb', line 158

def create name, type, attributes = {}

  attribute_list = []

  attributes.each do |attr_name,values|
    [values].flatten.each do |value|
      attribute_list << { 
        :attribute_name => attr_name, 
        :attribute_value => value.to_s 
      }
    end
  end

  client.create_load_balancer_policy(
    :load_balancer_name => load_balancer.name,
    :policy_name => name.to_s,
    :policy_type_name => type.to_s,
    :policy_attributes => attribute_list)

  LoadBalancerPolicy.new(load_balancer, name, :type => type.to_s)

end