Sha256: 23c5de632f72a955815761fb363a30c745ff56978eaff24a355ed5567539fd84

Contents?: true

Size: 1.12 KB

Versions: 45

Compression:

Stored size: 1.12 KB

Contents

module Aws
  module Plugins

    # @seahorse.client.option [required, String] :region
    #   The AWS region to connect to.  The region is used to construct
    #   the client endpoint.  Defaults to `ENV['AWS_DEFAULT_REGION']`.
    #   Also checks `AWS_REGION` and `AMAZON_REGION`.
    #
    # @seahorse.client.option [String] :endpoint A default endpoint is
    #   constructed from the `:region`.
    #
    class RegionalEndpoint < Seahorse::Client::Plugin

      # raised when region is not configured
      MISSING_REGION = 'missing required configuration option :region'

      option(:region) {
        keys = %w(AWS_REGION AMAZON_REGION AWS_DEFAULT_REGION)
        ENV.values_at(*keys).compact.first
      }

      option(:endpoint) do |cfg|
        EndpointProvider.resolve(cfg.region, cfg.api.metadata('endpointPrefix'))
      end

      def after_initialize(client)
        if client.config.region.nil? or client.config.region == ''
          msg = "missing region; use :region option or "
          msg << "export region name to ENV['AWS_REGION']"
          raise Errors::MissingRegionError, msg
        end
      end

    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.48 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.47 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.46 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.45 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.44 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.43 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.42 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.41 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.40 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.39 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.38 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.37 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.36 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.35 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.34 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.33 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.32 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.31 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.30 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.0.29 lib/aws-sdk-core/plugins/regional_endpoint.rb