blob: 29834d63f355ca04ab0587b3d1e344cbf59a320f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# frozen_string_literal: true
module Mutations
module AlertManagement
module PrometheusIntegration
class PrometheusIntegrationBase < BaseMutation
field :integration,
Types::AlertManagement::PrometheusIntegrationType,
null: true,
description: "Newly created integration."
authorize :admin_project
private
def find_object(id:)
GitlabSchema.object_from_id(id, expected_class: ::Integrations::Prometheus)
end
def response(integration, result)
{
integration: integration,
errors: Array(result[:message])
}
end
def integration_attributes(args)
{
prometheus_integration_attributes: {
manual_configuration: args[:active],
api_url: args[:api_url]
}.compact
}
end
def token_attributes
{ alerting_setting_attributes: { regenerate_token: true } }
end
end
end
end
end
|