class Aws::Partitions::Region
Attributes
description[R]
@return [String] A short description of this region.
name[R]
@return [String] The name of this region, e.g. “us-east-1”.
partition_name[R]
@return [String] The partition this region exists in, e.g. “aws”,
"aws-cn", "aws-us-gov".
services[R]
@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.
Public Class Methods
build(region_name, region, partition)
click to toggle source
@api private
# File lib/aws-partitions/region.rb, line 39 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
new(options = {})
click to toggle source
@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-partitions/region.rb, line 14 def initialize(options = {}) @name = options[:name] @description = options[:description] @partition_name = options[:partition_name] @services = options[:services] end
Private Class Methods
region_services(region_name, partition)
click to toggle source
# File lib/aws-partitions/region.rb, line 50 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
service_in_region?(svc, region_name)
click to toggle source
# File lib/aws-partitions/region.rb, line 61 def service_in_region?(svc, region_name) svc.key?('endpoints') && svc['endpoints'].key?(region_name) end