Sha256: 82729e600996f0103d115b94227275311e4d7496d6691d27dcdb6f5d196057d0

Contents?: true

Size: 1.74 KB

Versions: 71

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true

module Aws
  module S3
    module Plugins
      # Provides support for using `Aws::S3::Client` with Amazon S3 Transfer
      # Acceleration.
      #
      # Go here for more information about transfer acceleration:
      # [http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html)
      class Accelerate < Seahorse::Client::Plugin
        option(
          :use_accelerate_endpoint,
          default: false,
          doc_type: 'Boolean',
          docstring: <<-DOCS)
When set to `true`, accelerated bucket endpoints will be used
for all object operations. You must first enable accelerate for
each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html).
          DOCS

        def add_handlers(handlers, config)
          operations = config.api.operation_names - [
            :create_bucket, :list_buckets, :delete_bucket
          ]
          handlers.add(
            OptionHandler, step: :initialize, operations: operations
          )
        end

        # @api private
        class OptionHandler < Seahorse::Client::Handler
          def call(context)
            # Support client configuration and per-operation configuration
            # TODO: move this to an options hash and warn here.
            if context.params.is_a?(Hash)
              accelerate = context.params.delete(:use_accelerate_endpoint)
            end
            if accelerate.nil?
              accelerate = context.config.use_accelerate_endpoint
            end
            context[:use_accelerate_endpoint] = accelerate
            @handler.call(context)
          end
        end
      end
    end
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
aws-sdk-s3-1.174.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.173.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.172.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.171.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.170.1 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.170.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.169.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.168.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.167.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.166.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.165.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.164.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.163.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.162.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.161.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.160.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.159.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.158.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.157.0 lib/aws-sdk-s3/plugins/accelerate.rb
aws-sdk-s3-1.156.0 lib/aws-sdk-s3/plugins/accelerate.rb