Sha256: 641fb18f460e53654f38d827641e87f4c38477272be82e7947d4b0da91b7a77f
Contents?: true
Size: 919 Bytes
Versions: 2
Compression:
Stored size: 919 Bytes
Contents
require 'aws-sdk' module AwsDump class VPC < Hash def initialize(region, vpc) @region = region @vpc = vpc self[:name] = vpc.tags["Name"] self[:instances] = instances.sort self[:security_groups] = security_groups.sort self[:rds_instances] = rds_instances end def <=>(other) self[:name] <=> other[:name] end def instances @vpc.instances.collect do |instance| Instance.new(self, instance) end end def security_groups @vpc.security_groups.collect do |security_group| SecurityGroup.new(self, security_group) end.compact end def rds_instances rds = AWS::RDS.new(@region.account.options.merge(:region => @region[:name])) rds.instances.collect do |instance| unless instance.vpc_id == @vpc.id RDSInstance.new(self, instance) end end.compact end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aws_dump-0.0.2 | lib/aws_dump/vpc.rb |
aws_dump-0.0.1 | lib/aws_dump/vpc.rb |