Sha256: a361faa2911fac3b6159c5fb6e0cb2985aaf6c1989c696d2c0c3c9254ced14ab

Contents?: true

Size: 1.26 KB

Versions: 70

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

module Aws
  module S3
    module Plugins

      class IADRegionalEndpoint < Seahorse::Client::Plugin

        option(:s3_us_east_1_regional_endpoint,
          default: 'legacy',
          doc_type: String,
          docstring: <<-DOCS) do |cfg|
Pass in `regional` to enable the `us-east-1` regional endpoint.
Defaults to `legacy` mode which uses the global endpoint.
          DOCS
          resolve_iad_regional_endpoint(cfg)
        end

        private

        def self.resolve_iad_regional_endpoint(cfg)
          default_mode_value =
            if cfg.respond_to?(:defaults_mode_config_resolver)
              cfg.defaults_mode_config_resolver.resolve(:s3_us_east_1_regional_endpoint)
            end

          mode = ENV['AWS_S3_US_EAST_1_REGIONAL_ENDPOINT'] ||
            Aws.shared_config.s3_us_east_1_regional_endpoint(profile: cfg.profile) ||
            default_mode_value ||
            'legacy'
          mode = mode.downcase
          unless %w(legacy regional).include?(mode)
            raise ArgumentError, "expected :s3_us_east_1_regional_endpoint or"\
              " ENV['AWS_S3_US_EAST_1_REGIONAL_ENDPOINT'] to be `legacy` or"\
              " `regional`."
          end
          mode
        end

      end

    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
aws-sdk-s3-1.154.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.153.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.152.3 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.152.2 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.152.1 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.152.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.149.1 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.149.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.148.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.147.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.146.1 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.146.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.145.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.144.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.143.1 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.143.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.142.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.141.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.140.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb
aws-sdk-s3-1.139.0 lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb