Class: CfnNag

Inherits:
Object
  • Object
show all
Includes:
Rule
Defined in:
lib/cfn_nag.rb

Instance Attribute Summary

Attributes included from Rule

#input_json_path

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Rule

#add_violation, #assertion, count_failures, count_warnings, empty?, #fatal_assertion, #fatal_violation, #raw_fatal_assertion, #raw_fatal_violation, #resources, #resources_by_type, #violation, #warning

Class Method Details

.configure_logging(opts) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/cfn_nag.rb', line 26

def self.configure_logging(opts)
  logger = Logging.logger['log']
  if opts[:debug]
    logger.level = :debug
  else
    logger.level = :info
  end

  logger.add_appenders Logging.appenders.stdout
end

Instance Method Details

#audit(input_json_path:, output_format: 'txt') ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cfn_nag.rb', line 11

def audit(input_json_path:,
          output_format:'txt')
  fail 'not even legit JSON' unless legal_json?(input_json_path)

  @violations = []

  generic_json_rules input_json_path

  custom_rules input_json_path

  results_renderer(output_format).new.render(@violations)

  Rule::count_failures(@violations)
end