Module: Metadata

Included in:
CustomRuleLoader
Defined in:
lib/cfn-nag/metadata.rb

Overview

Mix-in with metadata handling routines for the CustomRuleLoader

Instance Method Summary collapse

Instance Method Details

#cfn_model_with_suppressed_resources_removed(cfn_model:, rule_id:, allow_suppression:, print_suppression:) ⇒ Object


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cfn-nag/metadata.rb', line 20

def cfn_model_with_suppressed_resources_removed(cfn_model:,
                                                rule_id:,
                                                allow_suppression:,
                                                print_suppression:)
  return cfn_model unless allow_suppression

  cfn_model = cfn_model.copy

  cfn_model.resources.delete_if do |logical_resource_id, resource|
    rules_to_suppress = rules_to_suppress resource
    if rules_to_suppress.nil?
      false
    else
      suppress_resource?(rules_to_suppress, rule_id, logical_resource_id, print_suppression)
    end
  end
  cfn_model
end

#validate_cfn_nag_metadata(cfn_model) ⇒ Object

XXX given mangled_metadatas is never used or returned, STDERR emit can be moved to unless block


10
11
12
13
14
15
16
17
18
# File 'lib/cfn-nag/metadata.rb', line 10

def (cfn_model)
  mangled_metadatas = (cfn_model)
  mangled_metadatas.each do ||
    logical_resource_id = .first
    mangled_rules = [1]

    STDERR.puts "#{logical_resource_id} has missing cfn_nag suppression rule id: #{mangled_rules}"
  end
end