[ [ 'code' => 'HttpException', 'status' => '502', 'detail' => 'Server must be online in order to send commands.', ], ], ]; /** * Send a command to a running server. * * @throws DaemonConnectionException */ #[Endpoint('Send server command', 'Sends a console command to the running server through Wings.')] #[ScribeResponse(status: 204, description: 'Command accepted by Wings.')] #[ScribeResponse(self::OFFLINE_ERROR, status: 502, description: 'The server is not online or Wings rejected the command.')] public function index(SendCommandRequest $request, SendsServerCommands $commands, Server $server): Response { $command = JsonValueGuard::string($request->validated('command')); $commands->send($server, $command); Activity::event('server:console.command')->property('command', $command)->log(); return $this->returnNoContent(); } }