debian-mirror-gitlab/app/graphql/mutations/alert_management/prometheus_integration/update.rb

36 lines
1 KiB
Ruby
Raw Normal View History

2021-01-29 00:20:46 +05:30
# frozen_string_literal: true
module Mutations
module AlertManagement
module PrometheusIntegration
class Update < PrometheusIntegrationBase
graphql_name 'PrometheusIntegrationUpdate'
2021-09-30 23:02:18 +05:30
argument :id, Types::GlobalIDType[::Integrations::Prometheus],
2021-01-29 00:20:46 +05:30
required: true,
2021-10-27 15:23:28 +05:30
description: "ID of the integration to mutate."
2021-01-29 00:20:46 +05:30
2021-10-27 15:23:28 +05:30
argument :active, GraphQL::Types::Boolean,
2021-01-29 00:20:46 +05:30
required: false,
2021-03-08 18:12:59 +05:30
description: "Whether the integration is receiving alerts."
2021-01-29 00:20:46 +05:30
2021-10-27 15:23:28 +05:30
argument :api_url, GraphQL::Types::String,
2021-01-29 00:20:46 +05:30
required: false,
2021-04-29 21:17:54 +05:30
description: "Endpoint at which Prometheus can be queried."
2021-01-29 00:20:46 +05:30
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