Class: Inventory::Cfn

Inherits:
Base
  • Object
show all
Defined in:
lib/inventory/cfn.rb

Constant Summary collapse

ALL_STATUSES =
%w[
  REVIEW_IN_PROGRESS
  CREATE_FAILED
  UPDATE_ROLLBACK_FAILED
  UPDATE_ROLLBACK_IN_PROGRESS
  CREATE_IN_PROGRESS
  UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS
  ROLLBACK_IN_PROGRESS
  DELETE_COMPLETE
  UPDATE_COMPLETE
  UPDATE_IN_PROGRESS
  DELETE_FAILED
  DELETE_IN_PROGRESS
  ROLLBACK_COMPLETE
  ROLLBACK_FAILED
  UPDATE_COMPLETE_CLEANUP_IN_PROGRESS
  CREATE_COMPLETE
  UPDATE_ROLLBACK_COMPLETE
]
ACTIVE_STATUSES =
ALL_STATUSES - %w[DELETE_COMPLETE]

Instance Method Summary collapse

Methods inherited from Base

eager_load!, inherited, #initialize, #report, #show, #sort, subclasses, #test_mode

Methods included from AwsServices

#acm, #cfn, #cw, #eb, #ec2, #ecs, #elbv1, #elbv2, #iam, #pricing, #rds, #route53

Methods included from Shared

#instances, #security_groups

Constructor Details

This class inherits a constructor from Inventory::Base

Instance Method Details

#dataObject



27
28
29
30
31
# File 'lib/inventory/cfn.rb', line 27

def data
  stack_summaries.map do |summary|
    [summary.stack_name, summary.template_description]
  end
end

#headerObject



23
24
25
# File 'lib/inventory/cfn.rb', line 23

def header
  ["Stack Name", "Description"]
end

#stack_summariesObject



33
34
35
# File 'lib/inventory/cfn.rb', line 33

def stack_summaries
  @stack_summaries ||= cfn.list_stacks(stack_status_filter: ACTIVE_STATUSES).stack_summaries
end

#text_tableObject

unused right now but leaving around to later figure out how to integrate



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/inventory/cfn.rb', line 38

def text_table
  stack_summaries.each do |summary|
    table.rows << [summary.stack_name, summary.template_description]
  end

  table = Text::Table.new
  table.head = %w[Name Description]
  stack_summaries.each do |summary|
    table.rows << [summary.stack_name, summary.template_description]
  end
  puts table
end