Path: blob/1.0-develop/app/Http/Controllers/Api/Application/Servers/ServerManagementController.php
10277 views
<?php12namespace Pterodactyl\Http\Controllers\Api\Application\Servers;34use Illuminate\Http\Response;5use Pterodactyl\Models\Server;6use Pterodactyl\Services\Servers\SuspensionService;7use Pterodactyl\Services\Servers\ReinstallServerService;8use Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest;9use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;1011class ServerManagementController extends ApplicationApiController12{13/**14* ServerManagementController constructor.15*/16public function __construct(17private ReinstallServerService $reinstallServerService,18private SuspensionService $suspensionService,19) {20parent::__construct();21}2223/**24* Suspend a server on the Panel.25*26* @throws \Throwable27*/28public function suspend(ServerWriteRequest $request, Server $server): Response29{30$this->suspensionService->toggle($server);3132return $this->returnNoContent();33}3435/**36* Unsuspend a server on the Panel.37*38* @throws \Throwable39*/40public function unsuspend(ServerWriteRequest $request, Server $server): Response41{42$this->suspensionService->toggle($server, SuspensionService::ACTION_UNSUSPEND);4344return $this->returnNoContent();45}4647/**48* Mark a server as needing to be reinstalled.49*50* @throws \Pterodactyl\Exceptions\DisplayException51* @throws \Pterodactyl\Exceptions\Model\DataValidationException52* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException53*/54public function reinstall(ServerWriteRequest $request, Server $server): Response55{56$this->reinstallServerService->handle($server);5758return $this->returnNoContent();59}60}616263