Class: CfnNag

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

Instance Attribute Summary

Attributes included from Rule

#failure_count, #input_json_path

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Rule

#assertion, #fatal_assertion, #fatal_violation, #message, #raw_fatal_assertion, #raw_fatal_violation, #resources, #resources_by_type, #violation, #warning

Class Method Details

.configure_logging(opts) ⇒ Object



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

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) ⇒ Object



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

def audit(input_json_path)
  fail 'not even legit JSON' unless legal_json?(input_json_path)

  @violation_count = 0
  @warning_count = 0

  generic_json_rules input_json_path

  custom_rules input_json_path

  puts "Violations count: #{@violation_count}"
  puts "Warnings count: #{@warning_count}"
  @violation_count
end