Class: Mihari::Emitters::Database
- Defined in:
- lib/mihari/emitters/database.rb
Constant Summary
Constants included from Mixins::Retriable
Instance Method Summary collapse
- #configuration_keys ⇒ Object
-
#emit(artifacts:, rule:) ⇒ Mihari::Alert
Create an alert.
- #valid? ⇒ Boolean
Methods inherited from Base
Methods included from Mixins::Retriable
Methods included from Mixins::Configurable
#configuration_values, #configured?
Constructor Details
This class inherits a constructor from Mihari::Emitters::Base
Instance Method Details
#configuration_keys ⇒ Object
33 34 35 |
# File 'lib/mihari/emitters/database.rb', line 33 def configuration_keys %w[database_url] end |
#emit(artifacts:, rule:) ⇒ Mihari::Alert
Create an alert
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mihari/emitters/database.rb', line 18 def emit(artifacts:, rule:) return if artifacts.empty? = rule..filter_map { |name| Tag.find_or_create_by(name: name) }.uniq taggings = .map { |tag| Tagging.new(tag_id: tag.id) } alert = Alert.new( artifacts: artifacts, taggings: taggings, rule_id: rule.id ) alert.save alert end |
#valid? ⇒ Boolean
6 7 8 |
# File 'lib/mihari/emitters/database.rb', line 6 def valid? true end |