debian-mirror-gitlab/app/graphql/mutations/ci/runner/delete.rb
2022-07-16 19:58:13 +02:00

31 lines
701 B
Ruby

# frozen_string_literal: true
module Mutations
module Ci
module Runner
class Delete < BaseMutation
graphql_name 'RunnerDelete'
authorize :delete_runner
RunnerID = ::Types::GlobalIDType[::Ci::Runner]
argument :id, RunnerID,
required: true,
description: 'ID of the runner to delete.'
def resolve(id:, **runner_attrs)
runner = authorized_find!(id)
::Ci::Runners::UnregisterRunnerService.new(runner, current_user).execute
{ errors: runner.errors.full_messages }
end
def find_object(id)
GitlabSchema.find_by_gid(id)
end
end
end
end
end