Sha256: 9cedf42ba9cb39ce4cb73c2d6ae94ad0d78b8f25c8dd5d09ceb8b773ce8d3356

Contents?: true

Size: 1.66 KB

Versions: 97

Compression:

Stored size: 1.66 KB

Contents

module Fog
  module AWS
    class SQS
      class Real
        require 'fog/aws/parsers/sqs/basic'

        # Get attributes of a queue
        #
        # ==== Parameters
        # * queue_url<~String> - Url of queue to get attributes for
        # * attribute_name<~String> - Name of attribute to set, keys in ['MaximumMessageSize', 'MessageRetentionPeriod', 'Policy', 'VisibilityTimeout']
        # * attribute_value<~String> - Value to set for attribute
        #
        # ==== See Also
        # http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Query_QuerySetQueueAttributes.html
        #

        def set_queue_attributes(queue_url, attribute_name, attribute_value)
          request({
            'Action'          => 'SetQueueAttributes',
            'Attribute.Name'  => attribute_name,
            'Attribute.Value' => attribute_value,
            :path             => path_from_queue_url(queue_url),
            :parser           => Fog::Parsers::AWS::SQS::Basic.new
          })
        end
      end

      class Mock
        def set_queue_attributes(queue_url, attribute_name, attribute_value)
          Excon::Response.new.tap do |response|
            if (queue = data[:queues][queue_url])
              response.status = 200
              queue['Attributes'][attribute_name] = attribute_value
              response.body = {
                'ResponseMetadata' => {
                  'RequestId' => Fog::AWS::Mock.request_id
                }
              }
            else
              response.status = 404
              raise(Excon::Errors.status_error({:expects => 200}, response))
            end
          end
        end
      end
    end
  end
end

Version data entries

97 entries across 95 versions & 6 rubygems

Version Path
fog-aws-3.29.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.28.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.27.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.26.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.25.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.24.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.23.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.22.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.21.1 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.21.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.20.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.19.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.18.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.17.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.16.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.15.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.14.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.13.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.12.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb
fog-aws-3.11.0 lib/fog/aws/requests/sqs/set_queue_attributes.rb