Sha256: 6d80aab26f2748bb727f7f44e9b2f1485c524e3c2b4783dbb74f0cc9178a92e6

Contents?: true

Size: 1.24 KB

Versions: 48

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
          connection_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

          connection.send(method, *args)
          reload
        end

        def destroy
          requires :id, :load_balancer
          connection.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

48 entries across 48 versions & 14 rubygems

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