mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-13 18:15:24 +00:00
feat(hetzner): add support for enabling backups during server creation
This commit is contained in:
1 parent
a4b27641c8
commit
6637159d7b
6 files changed
+148
-10
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Exceptions\RateLimitException;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class HetznerService
|
||||
@@ -24,7 +25,7 @@ class HetznerService
|
||||
->timeout(30)
|
||||
->retry(3, function (int $attempt, \Exception $exception) {
|
||||
// Handle rate limiting (429 Too Many Requests)
|
||||
if ($exception instanceof \Illuminate\Http\Client\RequestException) {
|
||||
if ($exception instanceof RequestException) {
|
||||
$response = $exception->response;
|
||||
|
||||
if ($response && $response->status() === 429) {
|
||||
@@ -153,6 +154,13 @@ class HetznerService
|
||||
return $response['server'] ?? [];
|
||||
}
|
||||
|
||||
public function enableServerBackup(int $serverId): array
|
||||
{
|
||||
$response = $this->request('post', "/servers/{$serverId}/actions/enable_backup");
|
||||
|
||||
return $response['action'] ?? [];
|
||||
}
|
||||
|
||||
public function getServer(int $serverId): array
|
||||
{
|
||||
$response = $this->request('get', "/servers/{$serverId}");
|
||||
|
||||
Reference in new issue
Block a user