Sha256: e72233689c46f0dae1e896f74c98813d92d668374b50ed576f788b8cec3fc67a

Contents?: true

Size: 894 Bytes

Versions: 1052

Compression:

Stored size: 894 Bytes

Contents

module Aws
  module Plugins

    # When making calls to {S3::Client#create_bucket} outside the
    # "classic" region, the bucket location constraint must be specified.
    # This plugin auto populates the constraint to the configured region.
    class S3LocationConstraint < Seahorse::Client::Plugin

      class Handler < Seahorse::Client::Handler

        def call(context)
          unless context.config.region == 'us-east-1'
            populate_location_constraint(context.params, context.config.region)
          end
          @handler.call(context)
        end

        private

        def populate_location_constraint(params, region)
          params[:create_bucket_configuration] ||= {}
          params[:create_bucket_configuration][:location_constraint] ||= region
        end

      end

      handler(Handler, step: :initialize, operations: [:create_bucket])

    end
  end
end

Version data entries

1,052 entries across 1,052 versions & 2 rubygems

Version Path
aws-sdk-core-2.11.592 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.591 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.590 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.589 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.588 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.587 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.586 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.585 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.584 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.583 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.582 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.581 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.580 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.579 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.578 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.577 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.576 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.575 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.574 lib/aws-sdk-core/plugins/s3_location_constraint.rb
aws-sdk-core-2.11.573 lib/aws-sdk-core/plugins/s3_location_constraint.rb