Class: CfnNag::BaseRule

Inherits:
Object show all
Defined in:
lib/cfn-nag/base_rule.rb

Instance Method Summary collapse

Instance Method Details

#audit(cfn_model) ⇒ Object

Returns nil when there are no violations Returns a Violation object otherwise


19
20
21
22
23
24
25
26
27
# File 'lib/cfn-nag/base_rule.rb', line 19

def audit(cfn_model)
  logical_resource_ids = audit_impl(cfn_model)
  return if logical_resource_ids.empty?

  Violation.new(id: rule_id,
                type: rule_type,
                message: rule_text,
                logical_resource_ids: logical_resource_ids)
end

#audit_impl(_cfn_model) ⇒ Object

Returns a collection of logical resource ids


11
12
13
# File 'lib/cfn-nag/base_rule.rb', line 11

def audit_impl(_cfn_model)
  raise 'must implement in subclass'
end