summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/alert_management/prometheus_integration/update.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/mutations/alert_management/prometheus_integration/update.rb')
-rw-r--r--app/graphql/mutations/alert_management/prometheus_integration/update.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/graphql/mutations/alert_management/prometheus_integration/update.rb b/app/graphql/mutations/alert_management/prometheus_integration/update.rb
new file mode 100644
index 00000000000..1f0dea119c5
--- /dev/null
+++ b/app/graphql/mutations/alert_management/prometheus_integration/update.rb
@@ -0,0 +1,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