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