Sha256: 460d70424c9fd51014650d94c0c3f299bd6757b145f7a7ca7ab02ed50dabedcd

Contents?: true

Size: 1.18 KB

Versions: 72

Compression:

Stored size: 1.18 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_REGION']`.
    #   Also checks `AMAZON_REGION` and `AWS_DEFAULT_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|
        if endpoint_prefix = cfg.api.metadata['endpointPrefix']
          EndpointProvider.resolve(cfg.region, endpoint_prefix)
        end
      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

72 entries across 72 versions & 2 rubygems

Version Path
aws-sdk-core-2.3.23 lib/aws-sdk-core/plugins/regional_endpoint.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/aws-sdk-core-2.3.22/lib/aws-sdk-core/plugins/regional_endpoint.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/aws-sdk-core-2.3.22/lib/aws-sdk-core/plugins/regional_endpoint.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/aws-sdk-core-2.3.22/lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.22 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.21 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.20 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.19 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.18 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.17 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.16 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.15 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.14 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.13 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.12 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.11 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.10 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.9 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.8 lib/aws-sdk-core/plugins/regional_endpoint.rb
aws-sdk-core-2.3.7 lib/aws-sdk-core/plugins/regional_endpoint.rb