Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-29 15:10:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-29 15:10:00 +0300
commit4233d3aa86fe94e6288279aa55d42ed95bfe753c (patch)
tree7b97b519371f6df1fa6a0f2ffe69535207a73754 /lib/gitlab/alert_management
parente357d4951c53a3ce4f696cf533ce24a4c6350a7e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/alert_management')
-rw-r--r--lib/gitlab/alert_management/alert_params.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/alert_management/alert_params.rb b/lib/gitlab/alert_management/alert_params.rb
new file mode 100644
index 00000000000..014eba6326d
--- /dev/null
+++ b/lib/gitlab/alert_management/alert_params.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module AlertManagement
+ class AlertParams
+ def self.from_generic_alert(project:, payload:)
+ parsed_payload = Gitlab::Alerting::NotificationPayloadParser.call(payload).with_indifferent_access
+ annotations = parsed_payload[:annotations]
+
+ {
+ project_id: project.id,
+ title: annotations[:title],
+ description: annotations[:description],
+ monitoring_tool: annotations[:monitoring_tool],
+ service: annotations[:service],
+ hosts: Array(annotations[:hosts]),
+ payload: payload,
+ started_at: parsed_payload['startsAt']
+ }
+ end
+ end
+ end
+end