Sha256: c62fff86c81baa5435ce76e6c18a54e7529d800035a2c6d26b152ddb943c085f

Contents?: true

Size: 1.72 KB

Versions: 25

Compression:

Stored size: 1.72 KB

Contents

require 'fog/core/model'
module Fog
  module AWS
    class ELB
      class Listener < Fog::Model

        attribute :policy_names,      :aliases => 'PolicyNames'
        attribute :instance_port,     :aliases => 'InstancePort'
        attribute :instance_protocol, :aliases => 'InstanceProtocol'
        attribute :lb_port,           :aliases => 'LoadBalancerPort'
        attribute :protocol,          :aliases => 'Protocol'
        attribute :ssl_id,            :aliases => 'SSLCertificateId'

        def initialize(attributes={})
          # set defaults, which may be overridden in super
          merge_attributes(:policy_names => [], :instance_port => 80, :instance_protocol => 'HTTP', :lb_port => 80, :protocol => 'HTTP')
          super
        end

        def save
          requires :load_balancer, :instance_port, :lb_port, :protocol, :instance_protocol
          connection.create_load_balancer_listeners(load_balancer.id, [to_params])
          reload
        end

        def destroy
          requires :load_balancer, :lb_port
          connection.delete_load_balancer_listeners(load_balancer.id, [lb_port])
          reload
        end

        # Return the policy associated with this load balancer
        def policy
          load_balancer.policies.get(policy_names.first)
        end

        def reload
          load_balancer.reload
        end

        def load_balancer
          collection.load_balancer
        end

        def to_params
          {
            'InstancePort'     => instance_port,
            'InstanceProtocol' => instance_protocol,
            'LoadBalancerPort' => lb_port,
            'Protocol'         => protocol,
            'SSLCertificateId' => ssl_id
          }
        end

      end

    end
  end
end

Version data entries

25 entries across 25 versions & 11 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/models/elb/listener.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/elb/listener.rb
fog-parser-fix-1.6.1 lib/fog/aws/models/elb/listener.rb
fog-test-again-1.6.0 lib/fog/aws/models/elb/listener.rb
fog-parser-fix-1.6.0 lib/fog/aws/models/elb/listener.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/elb/listener.rb
fog-sgonyea-1.8.1 lib/fog/aws/models/elb/listener.rb
fog-1.8.0 lib/fog/aws/models/elb/listener.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/elb/listener.rb
fog-1.7.0 lib/fog/aws/models/elb/listener.rb
fog-1.6.0 lib/fog/aws/models/elb/listener.rb
fog-1.5.0 lib/fog/aws/models/elb/listener.rb
fog-1.4.0 lib/fog/aws/models/elb/listener.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/elb/listener.rb
michiels-fog-1.3.1 lib/fog/aws/models/elb/listener.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/models/elb/listener.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/elb/listener.rb
fog-1.3.1 lib/fog/aws/models/elb/listener.rb
fog-1.3.0 lib/fog/aws/models/elb/listener.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/elb/listener.rb