Class: Ci::Runners::UnregisterRunnerManagerService

Inherits:
Object
  • Object
show all
Defined in:
app/services/ci/runners/unregister_runner_manager_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runner, author, system_id:) ⇒ UnregisterRunnerManagerService

Returns a new instance of UnregisterRunnerManagerService.

Parameters:

  • runner (Ci::Runner)

    the runner to unregister/destroy

  • author (User, authentication token String)

    the user or the authentication token authorizing the removal

  • system_id (String)

    ID of the system being unregistered



11
12
13
14
15
# File 'app/services/ci/runners/unregister_runner_manager_service.rb', line 11

def initialize(runner, author, system_id:)
  @runner = runner
  @author = author
  @system_id = system_id
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



6
7
8
# File 'app/services/ci/runners/unregister_runner_manager_service.rb', line 6

def author
  @author
end

#runnerObject (readonly)

Returns the value of attribute runner.



6
7
8
# File 'app/services/ci/runners/unregister_runner_manager_service.rb', line 6

def runner
  @runner
end

#system_idObject (readonly)

Returns the value of attribute system_id.



6
7
8
# File 'app/services/ci/runners/unregister_runner_manager_service.rb', line 6

def system_id
  @system_id
end

Instance Method Details

#executeObject



17
18
19
20
21
22
23
24
# File 'app/services/ci/runners/unregister_runner_manager_service.rb', line 17

def execute
  return system_id_missing_error if system_id.blank?

  runner_manager = runner.runner_managers.find_by_system_xid!(system_id)
  runner_manager.destroy!

  ServiceResponse.success
end