Class: Vaws::Aws::SubnetDescriber

Inherits:
Describer
  • Object
show all
Defined in:
lib/vaws/aws/subnet_describer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSubnetDescriber

Returns a new instance of SubnetDescriber.



9
10
11
12
# File 'lib/vaws/aws/subnet_describer.rb', line 9

def initialize
  @subnet_client = ::Aws::EC2::Client.new
  @term_table    = ''
end

Instance Attribute Details

#term_tableObject (readonly)

Returns the value of attribute term_table.



7
8
9
# File 'lib/vaws/aws/subnet_describer.rb', line 7

def term_table
  @term_table
end

Instance Method Details

#set_basic_infoObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vaws/aws/subnet_describer.rb', line 14

def set_basic_info
  rows    = []
  subnets = @subnet_client.describe_subnets
  subnets.subnets.each do |subnet|
    az        = subnet.availability_zone
    cidr      = subnet.cidr_block
    subnet_id = subnet.subnet_id
    vpc_id    = subnet.vpc_id

    rows << [cidr, subnet_id, az, vpc_id]
  end
  @term_table = Terminal::Table.new :headings => ['Cidr', 'SubnetId', 'Az', 'VpcId'], :rows => rows.sort
end