Class: AWS::EC2::RegionCollection

Inherits:
Collection show all
Defined in:
lib/aws/ec2/region_collection.rb

Overview

Represents all the regions available to your account.

Examples:

Getting a map of endpoints by region name

ec2.regions.inject({}) { |m, r| m[r.name] = r.endpoint; m }

Instance Attribute Summary

Attributes included from Core::Model

#config

Instance Method Summary collapse

Methods included from FilteredCollection

#filter, #filtered_request, #initialize

Methods included from Core::Model

#client, #config_prefix, #initialize, #inspect

Instance Method Details

#[](name) ⇒ Region

Returns The region identified by the given name (e.g. “us-east-1”).

Returns:

  • (Region)

    The region identified by the given name (e.g. “us-east-1”).


38
39
40
# File 'lib/aws/ec2/region_collection.rb', line 38

def [](name)
  super
end

#each {|Region| ... } ⇒ nil

Yields:

  • (Region)

    Each region that is available to your account.

Returns:

  • (nil)

25
26
27
28
29
30
31
32
33
34
# File 'lib/aws/ec2/region_collection.rb', line 25

def each
  response = filtered_request(:describe_regions)
  response.region_info.each do |r|
    region = Region.new(r.region_name,
                        :endpoint => r.region_endpoint,
                        :config => config)
    yield(region)
  end
  nil
end