Class: Mutations::Ci::Runner::AssignToProject
- Inherits:
-
BaseMutation
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- Mutations::Ci::Runner::AssignToProject
- Defined in:
- app/graphql/mutations/ci/runner/assign_to_project.rb
Constant Summary
Constants inherited from BaseMutation
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, authorization_scopes, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #ready?, #unauthorized_object
Methods included from Gitlab::Graphql::Authorize::AuthorizeResource
#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!
Instance Method Details
#find_project_and_runner!(args) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/graphql/mutations/ci/runner/assign_to_project.rb', line 26 def find_project_and_runner!(args) project = ::Project.find_by_full_path(args[:project_path]) raise_resource_not_available_error! unless project runner = (id: args[:runner_id]) raise_resource_not_available_error!("Runner is not a project runner") unless runner.project_type? [project, runner] end |
#resolve(**args) ⇒ Object
19 20 21 22 23 24 |
# File 'app/graphql/mutations/ci/runner/assign_to_project.rb', line 19 def resolve(**args) project, runner = find_project_and_runner!(args) result = ::Ci::Runners::AssignRunnerService.new(runner, project, current_user).execute { errors: result.errors } end |