@return [String] A short description of this region.
@return [String] The name of this region, e.g. “us-east-1”.
@return [String] The partition this region exists in, e.g. “aws”,
"aws-cn", "aws-us-gov".
@return [Set<String>] The list of services available in this region.
Service names are the module names as used by the AWS SDK for Ruby.
@api private
# File lib/aws-sdk-core/partitions/region.rb, line 37 def build(region_name, region, partition) Region.new( name: region_name, description: region['description'], partition_name: partition['partition'], services: region_services(region_name, partition) ) end
@option options [required, String] :name @option options [required, String] :description @option options [required, String] :partition_name @option options [required, Set<String>] :services @api private
# File lib/aws-sdk-core/partitions/region.rb, line 12 def initialize(options = {}) @name = options[:name] @description = options[:description] @partition_name = options[:partition_name] @services = options[:services] end
# File lib/aws-sdk-core/partitions/region.rb, line 48 def region_services(region_name, partition) Partitions.service_ids.inject(Set.new) do |services, (svc_name, svc_id)| if svc = partition['services'][svc_id] services << svc_name if service_in_region?(svc, region_name) else #raise "missing endpoints for #{svc_name} / #{svc_id}" end services end end
# File lib/aws-sdk-core/partitions/region.rb, line 59 def service_in_region?(svc, region_name) svc_endpoints_contains_region?(svc, region_name) || svc_partition_endpoint_matches_region?(svc, region_name) end
# File lib/aws-sdk-core/partitions/region.rb, line 64 def svc_endpoints_contains_region?(svc, region_name) svc['endpoints'].key?(region_name) end
# File lib/aws-sdk-core/partitions/region.rb, line 68 def svc_partition_endpoint_matches_region?(svc, region_name) if pe = svc['partitionEndpoint'] region = svc['endpoints'][pe].fetch('credentialScope', {})['region'] region == region_name end end