Class: AWS::ELB::ListenerCollection

Inherits:
Object
  • Object
show all
Includes:
Core::Collection::Simple, ListenerOpts
Defined in:
lib/aws/elb/listener_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 = {}) ⇒ ListenerCollection

Returns a new instance of ListenerCollection.



22
23
24
25
# File 'lib/aws/elb/listener_collection.rb', line 22

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

Instance Attribute Details

#load_balancerLoadBalancer (readonly)

Returns:



28
29
30
# File 'lib/aws/elb/listener_collection.rb', line 28

def load_balancer
  @load_balancer
end

Instance Method Details

#[](port) ⇒ Listener

Returns:



91
92
93
# File 'lib/aws/elb/listener_collection.rb', line 91

def [] port
  Listener.new(load_balancer, port, :config => config)
end

#create(options = {}) ⇒ Listener

Parameters:

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

Options Hash (options):

  • :port (Integer)

    Specifies the external load balancer port number. This property cannot be modified for the life of the LoadBalancer.

  • :protocol (String, Symbol)

    Specifies the load balancer transport protocol to use for routing. Valid values include:

  • :instance_port (Integer)

    Specifies the TCP port on which the instance server is listening. This property cannot be modified for the life of the load balancer.

  • :instance_protocol (String, Symbol)

    Specifies the protocol to use for routing traffic to back-end instances. Valid values include:

    • :http, ‘HTTP’

    • :https, ‘HTTPS’

    • :tcp, ‘TCP’

    • :ssl, ‘SSL’

    This property cannot be modified for the life of the load balacner.

    NOTE: If the front-end protocol is HTTP or HTTPS, :instance_protocol has to be at the same protocol layer, i.e., HTTP or HTTPS. Likewise, if the front-end protocol is TCP or SSL, :instance_protocol has to be TCP or SSL.

    NOTE: If there is another listener with the same :instance_port whose :instance_protocol is secure, i.e., HTTPS or SSL, the listener’s :instance_protocol has to be secure, i.e., HTTPS or SSL. If there is another listener with the same :instance_port whose :instance_protocol is HTTP or TCP, the listener’s :instance_protocol must be either HTTP or TCP.

    • :tcp, ‘TCP’

    • :http, ‘HTTP’

    This property cannot be modified for the life of the load balancer.

  • :server_certificate (String, IAM::ServerCertificate)

    The ARN string of an IAM::ServerCertifcate or an IAM::ServerCertificate object. Reqruied for HTTPs listeners.

Returns:



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/aws/elb/listener_collection.rb', line 76

def create options = {}
  
  format_listener_opts(options)

  client.create_load_balancer_listeners(
    :load_balancer_name => load_balancer.name,
    :listeners => [options])

  Listener.new(load_balancer, 
    options[:load_balancer_port], 
    options.merge(:config => config))

end