diff options
Diffstat (limited to 'app/models/alert_management')
-rw-r--r-- | app/models/alert_management/alert.rb | 9 | ||||
-rw-r--r-- | app/models/alert_management/http_integration.rb | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/app/models/alert_management/alert.rb b/app/models/alert_management/alert.rb index 7ce7f40b6a8..7090d9f4ea1 100644 --- a/app/models/alert_management/alert.rb +++ b/app/models/alert_management/alert.rb @@ -69,6 +69,11 @@ module AlertManagement unknown: 5 } + enum domain: { + operations: 0, + threat_monitoring: 1 + } + state_machine :status, initial: :triggered do state :triggered, value: STATUSES[:triggered] @@ -122,6 +127,8 @@ module AlertManagement scope :open, -> { with_status(open_statuses) } scope :not_resolved, -> { without_status(:resolved) } scope :with_prometheus_alert, -> { includes(:prometheus_alert) } + scope :with_threat_monitoring_alerts, -> { where(domain: :threat_monitoring ) } + scope :with_operations_alerts, -> { where(domain: :operations) } scope :order_start_time, -> (sort_order) { order(started_at: sort_order) } scope :order_end_time, -> (sort_order) { order(ended_at: sort_order) } @@ -263,3 +270,5 @@ module AlertManagement end end end + +AlertManagement::Alert.prepend_if_ee('EE::AlertManagement::Alert') diff --git a/app/models/alert_management/http_integration.rb b/app/models/alert_management/http_integration.rb index ae5170867c3..0c916c576cb 100644 --- a/app/models/alert_management/http_integration.rb +++ b/app/models/alert_management/http_integration.rb @@ -22,6 +22,7 @@ module AlertManagement validates :name, presence: true, length: { maximum: 255 } validates :endpoint_identifier, presence: true, length: { maximum: 255 }, format: { with: /\A[A-Za-z0-9]+\z/ } validates :endpoint_identifier, uniqueness: { scope: [:project_id, :active] }, if: :active? + validates :payload_attribute_mapping, json_schema: { filename: 'http_integration_payload_attribute_mapping' } before_validation :prevent_token_assignment before_validation :prevent_endpoint_identifier_assignment |