Sha256: 255bc8e4baff3953d60fa74660b39b7a2c86f20f8f8b9c6d5e8b0b57aff8b8f5

Contents?: true

Size: 1.96 KB

Versions: 44

Compression:

Stored size: 1.96 KB

Contents

module Fog
  module AWS
    class ELB
      class Real

        require 'fog/aws/parsers/elb/empty'

        # Create a Load Balancer Cookie Stickiness Policy
        #
        # ==== Parameters
        # * lb_name<~String> - Name of the ELB
        # * policy_name<~String> - The name of the policy being created. The name
        #   must be unique within the set of policies for this Load Balancer.
        # * cookie_expiration_period<~Integer> - The time period in seconds after
        #   which the cookie should be considered stale. Not specifying this
        #   parameter indicates that the sticky session will last for the duration of the browser session.
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'ResponseMetadata'<~Hash>:
        #       * 'RequestId'<~String> - Id of request
        def create_lb_cookie_stickiness_policy(lb_name, policy_name, cookie_expiration_period=nil)
          params = {'PolicyName' => policy_name, 'CookieExpirationPeriod' => cookie_expiration_period}

          request({
            'Action'           => 'CreateLBCookieStickinessPolicy',
            'LoadBalancerName' => lb_name,
            :parser            => Fog::Parsers::AWS::ELB::Empty.new
          }.merge!(params))
        end

      end

      class Mock
        def create_lb_cookie_stickiness_policy(lb_name, policy_name, cookie_expiration_period=nil)
          if load_balancer = self.data[:load_balancers][lb_name]
            response = Excon::Response.new
            response.status = 200

            create_load_balancer_policy(lb_name, policy_name, 'LBCookieStickinessPolicyType', {'CookieExpirationPeriod' => cookie_expiration_period})

            response.body = {
              'ResponseMetadata' => {
                'RequestId' => Fog::AWS::Mock.request_id
              }
            }

            response
          else
            raise Fog::AWS::ELB::NotFound
          end
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 3 rubygems

Version Path
fog-1.22.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-1.21.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-1.20.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-1.19.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb