summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/alert_management/http_integration/http_integration_base.rb
blob: e33b7bb399acc6c69438488235729d1cdc4f7ca4 (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
# frozen_string_literal: true

module Mutations
  module AlertManagement
    module HttpIntegration
      class HttpIntegrationBase < BaseMutation
        field :integration,
              Types::AlertManagement::HttpIntegrationType,
              null: true,
              description: "The HTTP integration."

        authorize :admin_operations

        private

        def find_object(id:)
          GitlabSchema.object_from_id(id, expected_class: ::AlertManagement::HttpIntegration)
        end

        def response(result)
          {
            integration: result.payload[:integration],
            errors: result.errors
          }
        end

        # overriden in EE
        def http_integration_params(_project, args)
          args.slice(:name, :active)
        end
      end
    end
  end
end

Mutations::AlertManagement::HttpIntegration::HttpIntegrationBase.prepend_if_ee('::EE::Mutations::AlertManagement::HttpIntegration::HttpIntegrationBase')