Class AWS::ELB::BackendServerPolicyCollection
In: lib/aws/elb/backend_server_policy_collection.rb
Parent: Object

Helps manage policies assigned to backend server instnace ports.

## Creating a Backend Server Policy

Creating a backend server policy can be a bit tricky. A BackendServerAuthenticationPolicyType policy only has one attribute, a list of public key policies.

Before you can assign a policy to a backend server instance port you must create on of the appropriate type:

    # step 1, create one (or more) PublicKeyPolicyType policies

    public_key1 = <<-KEY
    -----BEGIN CERTIFICATE-----
    MIICaTCCAdICCQDuvCF4erLGSjANBgkqhkiG9w0BAQUFADB5MQswCQYDVQQGEwJa
    ....
    o50MymfqtoVcebZcXbiDVAXW1cPEHKLBXecX6/LZ+GOzEsUOxgt7Xs9uabqp
    -----END CERTIFICATE-----
    KEY

    public_key_policy = load_balancer.policies.create("pkp",
      'PublicKeyPolicyType', 'PublicKey' => public_key.strip)

    # step 2, create the backend server policy, passing the public key policy

    name = 'backend-policy'
    type = 'BackendServerAuthenticationPolicyType'
    attributes = {
      # note: you can pass more than one public key policy here
      'PublicKeyPolicyName' => [public_key_policy]
    }

    backend_policy = @load_balancer.policies.create(name, type, attributes)
      'BackendServerAuthenticationPolicyType', attributes)

Once you have created a backend server authentication policy, you can assign it to a backend instance port:

    load_balancer.backend_server_policies[80] = backend_policy

If you want to remove the policy you can pass nil instead.

    # removes the policy from instance port 80
    load_balancer.backend_server_policies[80] = nil

You can also get the current policy:

    load_balancer.backend_server_policies[80] # returns a policy or nil

Methods

[]   []=   _each_item   new   policy_name  

Included Modules

Core::Collection::Simple

Attributes

load_balancer  [R]  @return [LoadBalancer]

Public Class methods

Public Instance methods

Returns the policy currently assigned to the given instance port.

@param [Integer] instance_port The backend server port to

  get the currently policy of.

@return [LoadBalancerPolicy,nil] Returns the load balancer policy

  currently assigned to the given instance port.  Returns nil if
  no policy has been assigned.

Sets the policy for the given backend server instance port.

@param [Integer] instance_port The instance port you want to set

  backend server policies for.

@param [String,LoadBalancerPolicy,nil] policy Load balancer policy

  name or object.  Passing nil removes the current policy.

@return [nil]

Protected Instance methods

[Validate]