Class: AwsCftTools::Runbooks::Diff::Context

Inherits:
Object
  • Object
show all
Includes:
Common::Templates, Reporting
Defined in:
lib/aws_cft_tools/runbooks/diff/context.rb,
lib/aws_cft_tools/runbooks/diff/context/reporting.rb

Overview

The context of stacks and templates for a Diff report.

Defined Under Namespace

Modules: Reporting

Constant Summary collapse

DIFF_OPTIONS =

The options provided to the diff command to build template diffs.

%w[-w -U5 -t].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Reporting

#output_report_on_differences, #output_report_on_missing_stacks, #output_report_on_missing_templates

Constructor Details

#initialize(stacks, templates, options = {}) ⇒ Context

Returns a new instance of Context.

Parameters:



29
30
31
32
33
# File 'lib/aws_cft_tools/runbooks/diff/context.rb', line 29

def initialize(stacks, templates, options = {})
  @stacks = build_map(stacks)
  @templates = build_map(templates)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/aws_cft_tools/runbooks/diff/context.rb', line 12

def options
  @options
end

#stacksObject (readonly)

Returns the value of attribute stacks.



12
13
14
# File 'lib/aws_cft_tools/runbooks/diff/context.rb', line 12

def stacks
  @stacks
end

#templatesObject (readonly)

Returns the value of attribute templates.



12
13
14
# File 'lib/aws_cft_tools/runbooks/diff/context.rb', line 12

def templates
  @templates
end

Instance Method Details

#report_on_differencesObject

Reports on the differences in the template bodies between the set of templates and the deployed stacks.



53
54
55
56
# File 'lib/aws_cft_tools/runbooks/diff/context.rb', line 53

def report_on_differences
  # these are stacks with templates
  output_report_on_differences(build_diffs)
end

#report_on_missing_stacksObject

Reports out templates that do not have corresponding stacks.



45
46
47
# File 'lib/aws_cft_tools/runbooks/diff/context.rb', line 45

def report_on_missing_stacks
  output_report_on_missing_stacks(templates.keys - stacks.keys)
end

#report_on_missing_templatesObject

Reports out stacks that do not have corresponding templates.



38
39
40
# File 'lib/aws_cft_tools/runbooks/diff/context.rb', line 38

def report_on_missing_templates
  output_report_on_missing_templates(stacks.keys - templates.keys)
end