Class: Vaws::Aws::Route53Describer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Describer

#single_option_validation

Constructor Details

#initializeRoute53Describer

Returns a new instance of Route53Describer.



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

def initialize
  @r53_client          = ::Aws::Route53::Client.new
  @r53_hosted_zone_ids = []
  @term_table          = ''
end

Instance Attribute Details

#term_tableObject (readonly)

Returns the value of attribute term_table.



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

def term_table
  @term_table
end

Instance Method Details

#set_basic_infoObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vaws/aws/route53_describer.rb', line 15

def set_basic_info
  rows = []

  zone_id                = selected_zone_id
  record_values          = ''
  next_record_identifier = nil
  next_record_name       = nil
  next_record_type       = nil

  begin
    param_args                           = {
      hosted_zone_id: zone_id,
      max_items:      200
    }
    param_args[:start_record_identifier] = next_record_identifier if next_record_identifier
    param_args[:start_record_name]       = next_record_name if next_record_name
    param_args[:start_record_type]       = next_record_type if next_record_type
    resp                                 = @r53_client.list_resource_record_sets(param_args)

    resp.resource_record_sets.each do |record_set|
      name = record_set.name
      type = record_set.type
      ttl  = record_set.ttl
      if record_set.alias_target.nil?
        record_set.resource_records.each do |record|
          record_values << "#{record.value.to_s}\n"
        end
      else
        record_values = record_set.alias_target.dns_name
      end
      rows << [name, type, record_values, ttl]
      record_values = ''
    end
    next_record_identifier = resp.next_record_identifier
    next_record_name       = resp.next_record_name
    next_record_type       = resp.next_record_type
  end while next_record_identifier
  @term_table = Terminal::Table.new :headings => ['Fqdn', 'Type', 'Value', 'Ttl'], :rows => rows.sort
end