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

update.rb « prometheus_integration « alert_management « mutations « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7594766176ff6a1d1993a722c1747bdfe8166fff (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
# frozen_string_literal: true

module Mutations
  module AlertManagement
    module PrometheusIntegration
      class Update < PrometheusIntegrationBase
        graphql_name 'PrometheusIntegrationUpdate'

        argument :id, Types::GlobalIDType[::PrometheusService],
                 required: true,
                 description: "The ID of the integration to mutate."

        argument :active, GraphQL::BOOLEAN_TYPE,
                 required: false,
                 description: "Whether the integration is receiving alerts."

        argument :api_url, GraphQL::STRING_TYPE,
                 required: false,
                 description: "Endpoint at which Prometheus can be queried."

        def resolve(args)
          integration = authorized_find!(id: args[:id])

          result = ::Projects::Operations::UpdateService.new(
            integration.project,
            current_user,
            integration_attributes(args)
          ).execute

          response integration.reset, result
        end
      end
    end
  end
end