Class: Aws::Partitions::Partition

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/partitions/partition.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Partition

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Partition.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :name (required, String)
  • :regions (required, Hash<String,Region>)
  • :services (required, Hash<String,Service>)


9
10
11
12
13
# File 'lib/aws-sdk-core/partitions/partition.rb', line 9

def initialize(options = {})
  @name = options[:name]
  @regions = options[:regions]
  @services = options[:services]
end

Instance Attribute Details

#nameString (readonly)

Returns The partition name, e.g. “aws”, “aws-cn”, “aws-us-gov”.

Returns:

  • (String)

    The partition name, e.g. “aws”, “aws-cn”, “aws-us-gov”.



16
17
18
# File 'lib/aws-sdk-core/partitions/partition.rb', line 16

def name
  @name
end

Class Method Details

.build(partition) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



57
58
59
60
61
62
63
# 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

Instance Method Details

#region(region_name) ⇒ Region

Parameters:

  • region_name (String)

    The name of the region, e.g. “us-east-1”.

Returns:

Raises:

  • (ArgumentError)

    Raises ‘ArgumentError` for unknown region name.



21
22
23
24
25
26
27
28
29
# 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

#regionsArray<Region>

Returns:



32
33
34
# File 'lib/aws-sdk-core/partitions/partition.rb', line 32

def regions
  @regions.values
end

#service(service_name) ⇒ Service

Parameters:

  • service_name (String)

    The service module name.

Returns:

Raises:

  • (ArgumentError)

    Raises ‘ArgumentError` for unknown service name.



39
40
41
42
43
44
45
46
47
# 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

#servicesArray<Service>

Returns:



50
51
52
# File 'lib/aws-sdk-core/partitions/partition.rb', line 50

def services
  @services.values
end