Module: Jackal::Cfn::Event::InheritedValidity

Defined in:
lib/jackal-cfn/event.rb

Instance Method Summary collapse

Instance Method Details

#valid?(message) ⇒ TrueClass, FalseClass

Determine message validity

Parameters:

  • message (Carnivore::Message)

Returns:

  • (TrueClass, FalseClass)


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jackal-cfn/event.rb', line 13

def valid?(message)
  super do |payload|
    data = payload.fetch(:data, :cfn_event, Smash.new)
    result = data[:origin_type] == 'Notification' &&
      data[:origin_subject].to_s.downcase.include?('cloudformation notification')
    if(result && block_given?)
      yield payload
    else
      result
    end
  end
end