Class: AwsDump::VPC
- Inherits:
-
Hash
- Object
- Hash
- AwsDump::VPC
- Defined in:
- lib/aws_dump/vpc.rb
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(region, vpc) ⇒ VPC
constructor
A new instance of VPC.
- #instances ⇒ Object
- #rds_instances ⇒ Object
- #security_groups ⇒ Object
Constructor Details
#initialize(region, vpc) ⇒ VPC
Returns a new instance of VPC.
5 6 7 8 9 10 11 12 |
# File 'lib/aws_dump/vpc.rb', line 5 def initialize(region, vpc) @region = region @vpc = vpc self[:name] = vpc.["Name"] self[:instances] = instances.sort self[:security_groups] = security_groups.sort self[:rds_instances] = rds_instances end |
Instance Method Details
#<=>(other) ⇒ Object
14 15 16 |
# File 'lib/aws_dump/vpc.rb', line 14 def <=>(other) self[:name] <=> other[:name] end |
#instances ⇒ Object
18 19 20 21 22 |
# File 'lib/aws_dump/vpc.rb', line 18 def instances @vpc.instances.collect do |instance| Instance.new(self, instance) end end |
#rds_instances ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/aws_dump/vpc.rb', line 30 def rds_instances rds = AWS::RDS.new(@region.account..merge(:region => @region[:name])) rds.instances.collect do |instance| unless instance.vpc_id == @vpc.id RDSInstance.new(self, instance) end end.compact end |
#security_groups ⇒ Object
24 25 26 27 28 |
# File 'lib/aws_dump/vpc.rb', line 24 def security_groups @vpc.security_groups.collect do |security_group| SecurityGroup.new(self, security_group) end.compact end |