Module: Datadog::AppSec::Processor::Actions
- Defined in:
- lib/datadog/appsec/processor/actions.rb
Overview
Actions store the actions information in memory Also, takes care of merging when RC send new information
Class Method Summary collapse
Class Method Details
.actions ⇒ Object
10 11 12 |
# File 'lib/datadog/appsec/processor/actions.rb', line 10 def actions @actions ||= [] end |
.fecth_configuration(action) ⇒ Object
14 15 16 |
# File 'lib/datadog/appsec/processor/actions.rb', line 14 def fecth_configuration(action) actions.find { |action_configuration| action_configuration['id'] == action } end |
.merge(actions_to_merge) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/datadog/appsec/processor/actions.rb', line 18 def merge(actions_to_merge) return if actions_to_merge.empty? if actions.empty? @actions = actions_to_merge else merged_actions = [] actions_dup = actions.dup actions_to_merge.each do |new_action| existing_action = actions_dup.find { |action| new_action['id'] == action['id'] } # the old action is discard and the new kept actions_dup.delete(existing_action) if existing_action merged_actions << new_action end @actions = merged_actions.concat(actions_dup) end end |