Class: Mutations::Ci::Runner::Update

Inherits:
BaseMutation
  • Object
show all
Defined in:
app/graphql/mutations/ci/runner/update.rb

Constant Summary collapse

RunnerID =
::Types::GlobalIDType[::Ci::Runner]

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods inherited from BaseMutation

#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #ready?, #unauthorized_object

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #raise_resource_not_available_error!

Instance Method Details

#find_object(id) ⇒ Object


67
68
69
# File 'app/graphql/mutations/ci/runner/update.rb', line 67

def find_object(id)
  GitlabSchema.find_by_gid(id)
end

#resolve(id:, **runner_attrs) ⇒ Object


57
58
59
60
61
62
63
64
65
# File 'app/graphql/mutations/ci/runner/update.rb', line 57

def resolve(id:, **runner_attrs)
  runner = authorized_find!(id)

  unless ::Ci::Runners::UpdateRunnerService.new(runner).update(runner_attrs)
    return { runner: nil, errors: runner.errors.full_messages }
  end

  { runner: runner, errors: [] }
end