Class: AwsDump::Region
- Inherits:
-
Hash
- Object
- Hash
- AwsDump::Region
- Defined in:
- lib/aws_dump/region.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(account, region) ⇒ Region
constructor
A new instance of Region.
- #instances ⇒ Object
- #rds_instances ⇒ Object
- #security_groups ⇒ Object
- #vpcs ⇒ Object
Constructor Details
#initialize(account, region) ⇒ Region
Returns a new instance of Region.
7 8 9 10 11 12 13 14 15 |
# File 'lib/aws_dump/region.rb', line 7 def initialize(account, region) @account = account @region = region self[:name] = region.name self[:vpcs] = vpcs.sort self[:instances] = instances.sort self[:security_groups] = security_groups.sort self[:rds_instances] = rds_instances end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
5 6 7 |
# File 'lib/aws_dump/region.rb', line 5 def account @account end |
Instance Method Details
#<=>(other) ⇒ Object
17 18 19 |
# File 'lib/aws_dump/region.rb', line 17 def <=>(other) self[:name] <=> other[:name] end |
#instances ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/aws_dump/region.rb', line 36 def instances @region.instances.collect do |instance| unless instance.subnet_id Instance.new(self, instance) end end.compact end |
#rds_instances ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/aws_dump/region.rb', line 27 def rds_instances rds = AWS::RDS.new(@account..merge(:region => self[:name])) rds.instances.collect do |instance| unless instance.vpc_id RDSInstance.new(self, instance) end end.compact end |
#security_groups ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/aws_dump/region.rb', line 44 def security_groups @region.security_groups.collect do |security_group| unless security_group.vpc_id SecurityGroup.new(self, security_group) end end.compact end |