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

module Mutations
  module AlertManagement
    module HttpIntegration
      class ResetToken < HttpIntegrationBase
        graphql_name 'HttpIntegrationResetToken'

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

        def resolve(id:)
          integration = authorized_find!(id: id)

          response ::AlertManagement::HttpIntegrations::UpdateService.new(
            integration,
            current_user,
            regenerate_token: true
          ).execute
        end
      end
    end
  end
end