Sha256: 2b5d2bca613a7ff60a85dd3780df9f3b61d27d2ca374c62007f472d16b7f97ba

Contents?: true

Size: 1.96 KB

Versions: 98

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

98 entries across 96 versions & 6 rubygems

Version Path
fog-aws-3.11.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.10.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.9.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.8.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.7.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.6.7 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.6.6 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.6.5 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.6.4 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.6.3 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.6.2 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.5.2 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.5.1 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.5.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.4.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.3.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.2.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
fog-aws-3.1.0 lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/elb/create_lb_cookie_stickiness_policy.rb