Sha256: fa5f5af769ca0750c2d02975493f79571cb1b713fc8a0969aed5a8ceda4f20ba

Contents?: true

Size: 745 Bytes

Versions: 38

Compression:

Stored size: 745 Bytes

Contents

module Aws
  # @api private
  class EndpointProvider

    # @api private
    PATH = File.join(File.dirname(__FILE__), '..', '..', 'endpoints.json')

    # @api private
    RULES = MultiJson.load(File.read(PATH))['endpoints']

    class << self

      def resolve(region, service)
        keys(region, service).each do |key|
          if match = RULES[key]
            return expand(match['endpoint'], region.to_s, service.to_s)
          end
        end
      end

      private

      def keys(region, service)
        ["#{region}/#{service}", "#{region}/*", "*/#{service}", "*/*"]
      end

      def expand(pattern, region, service)
        'https://' + pattern.sub('{region}', region).sub('{service}', service)
      end

    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

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