Sha256: 43cce19820ea84261b816c300cb6de91f5dac91c9265b7ef129234c349a04a1a

Contents?: true

Size: 1.24 KB

Versions: 21

Compression:

Stored size: 1.24 KB

Contents

require 'fog/core/model'
module Fog
  module AWS
    class ELB

      class Policy < Fog::Model
        identity :id, :aliases => 'PolicyName'

        attribute :cookie,     :aliases => 'CookieName'
        attribute :expiration, :aliases => 'CookieExpirationPeriod'

        attr_accessor :cookie_stickiness # Either :app or :lb

        def save
          requires :id, :load_balancer, :cookie_stickiness
          service_method = nil
          args = [load_balancer.id, id]
          case cookie_stickiness
          when :app
            requires :cookie
            method = :create_app_cookie_stickiness_policy
            args << cookie
          when :lb
            method = :create_lb_cookie_stickiness_policy
            args << expiration if expiration
          else
            raise ArgumentError.new('cookie_stickiness must be :app or :lb')
          end

          service.send(method, *args)
          reload
        end

        def destroy
          requires :id, :load_balancer
          service.delete_load_balancer_policy(load_balancer.id, id)
          reload
        end

        def reload
          load_balancer.reload
        end

        def load_balancer
          collection.load_balancer
        end

      end

    end
  end
end

Version data entries

21 entries across 21 versions & 6 rubygems

Version Path
gapinc-fog-1.12.1.2.1 lib/fog/aws/models/elb/policy.rb
fog-1.14.0 lib/fog/aws/models/elb/policy.rb
fog-1.13.0 lib/fog/aws/models/elb/policy.rb
gapinc-fog-1.12.1.2 lib/fog/aws/models/elb/policy.rb
gapinc-fog-1.12.1.1 lib/fog/aws/models/elb/policy.rb
gapinc-fog-1.12.1a lib/fog/aws/models/elb/policy.rb
gapinc-fog-1.12.1 lib/fog/aws/models/elb/policy.rb
fog-1.12.1 lib/fog/aws/models/elb/policy.rb
fog-1.12.0 lib/fog/aws/models/elb/policy.rb
hpfog-0.0.20 lib/fog/aws/models/elb/policy.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/models/elb/policy.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/models/elb/policy.rb
fog-1.11.1 lib/fog/aws/models/elb/policy.rb
fog-1.11.0 lib/fog/aws/models/elb/policy.rb
fog-1.10.1 lib/fog/aws/models/elb/policy.rb
fog-test-me-1.10.0 lib/fog/aws/models/elb/policy.rb
fog-1.10.0 lib/fog/aws/models/elb/policy.rb
fog-1.9.0 lib/fog/aws/models/elb/policy.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/aws/models/elb/policy.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/aws/models/elb/policy.rb