2022-03-02 08:16:31 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Clusters
|
|
|
|
module AgentTokens
|
|
|
|
class Revoke < BaseMutation
|
|
|
|
graphql_name 'ClusterAgentTokenRevoke'
|
|
|
|
|
|
|
|
authorize :admin_cluster
|
|
|
|
|
|
|
|
TokenID = ::Types::GlobalIDType[::Clusters::AgentToken]
|
|
|
|
|
|
|
|
argument :id, TokenID,
|
|
|
|
required: true,
|
|
|
|
description: 'Global ID of the agent token that will be revoked.'
|
|
|
|
|
|
|
|
def resolve(id:)
|
|
|
|
token = authorized_find!(id: id)
|
2023-05-27 22:25:52 +05:30
|
|
|
|
|
|
|
::Clusters::AgentTokens::RevokeService.new(token: token, current_user: current_user).execute
|
2022-03-02 08:16:31 +05:30
|
|
|
|
|
|
|
{ errors: errors_on_object(token) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|