class Aws::Partitions::Partition
Attributes
name[R]
@return [String] The partition name, e.g. “aws”, “aws-cn”, “aws-us-gov”.
Public Class Methods
build(partition)
click to toggle source
@api private
# File lib/aws-sdk-core/partitions/partition.rb, line 57 def build(partition) Partition.new( name: partition['partition'], regions: build_regions(partition), services: build_services(partition), ) end
new(options = {})
click to toggle source
@option options [required, String] :name @option options [required, Hash<String,Region>] :regions @option options [required, Hash<String,Service>] :services @api private
# File lib/aws-sdk-core/partitions/partition.rb, line 9 def initialize(options = {}) @name = options[:name] @regions = options[:regions] @services = options[:services] end
Private Class Methods
build_regions(partition)
click to toggle source
@param [Hash] partition @return [Hash<String,Region>]
# File lib/aws-sdk-core/partitions/partition.rb, line 69 def build_regions(partition) partition['regions'].inject({}) do |regions, (region_name, region)| unless region_name == "#{partition['partition']}-global" regions[region_name] = Region.build(region_name, region, partition) end regions end end
build_services(partition)
click to toggle source
@param [Hash] partition @return [Hash<String,Service>]
# File lib/aws-sdk-core/partitions/partition.rb, line 80 def build_services(partition) Partitions.service_ids.inject({}) do |services, (svc_name, svc_id)| if partition['services'].key?(svc_id) svc_data = partition['services'][svc_id] services[svc_name] = Service.build(svc_name, svc_data, partition) else services[svc_name] = Service.build(svc_name, {'endpoints' => {}}, partition) end services end end
Public Instance Methods
region(region_name)
click to toggle source
@param [String] region_name The name of the region, e.g. “us-east-1”. @return [Region] @raise [ArgumentError] Raises `ArgumentError` for unknown region name.
# File lib/aws-sdk-core/partitions/partition.rb, line 21 def region(region_name) if @regions.key?(region_name) @regions[region_name] else msg = "invalid region name #{region_name.inspect}; valid region " msg << "names include %s" % [@regions.keys.join(', ')] raise ArgumentError, msg end end
regions()
click to toggle source
@return [Array<Region>]
# File lib/aws-sdk-core/partitions/partition.rb, line 32 def regions @regions.values end
service(service_name)
click to toggle source
@param [String] service_name The service module name. @return [Service] @raise [ArgumentError] Raises `ArgumentError` for unknown service name.
# File lib/aws-sdk-core/partitions/partition.rb, line 39 def service(service_name) if @services.key?(service_name) @services[service_name] else msg = "invalid service name #{service_name.inspect}; valid service " msg << "names include %s" % [@services.keys.join(', ')] raise ArgumentError, msg end end
services()
click to toggle source
@return [Array<Service>]
# File lib/aws-sdk-core/partitions/partition.rb, line 50 def services @services.values end