2019-09-05 20:33:27 -07:00
|
|
|
<?php
|
|
|
|
|
|
2024-03-12 22:39:16 -04:00
|
|
|
namespace App\Repositories\Daemon;
|
2019-09-05 20:33:27 -07:00
|
|
|
|
2025-01-07 22:58:04 +01:00
|
|
|
use Illuminate\Http\Client\ConnectionException;
|
2024-10-19 21:00:11 -04:00
|
|
|
use Illuminate\Http\Client\Response;
|
2019-09-05 21:41:20 -07:00
|
|
|
|
2019-09-05 20:33:27 -07:00
|
|
|
class DaemonPowerRepository extends DaemonRepository
|
|
|
|
|
{
|
2019-09-05 21:41:20 -07:00
|
|
|
/**
|
|
|
|
|
* Sends a power action to the server instance.
|
|
|
|
|
*
|
2025-01-07 22:58:04 +01:00
|
|
|
* @throws ConnectionException
|
2019-09-05 21:41:20 -07:00
|
|
|
*/
|
2024-10-19 21:00:11 -04:00
|
|
|
public function send(string $action): Response
|
2019-09-05 21:41:20 -07:00
|
|
|
{
|
2025-01-07 22:58:04 +01:00
|
|
|
return $this->getHttpClient()->post("/api/servers/{$this->server->uuid}/power",
|
|
|
|
|
['action' => $action],
|
|
|
|
|
);
|
2019-09-05 21:41:20 -07:00
|
|
|
}
|
2019-09-05 20:33:27 -07:00
|
|
|
}
|