diff --git a/app/Repositories/Proxmox/Server/ProxmoxServerRepository.php b/app/Repositories/Proxmox/Server/ProxmoxServerRepository.php index bd3cc7cbc71..79d7ac656ab 100644 --- a/app/Repositories/Proxmox/Server/ProxmoxServerRepository.php +++ b/app/Repositories/Proxmox/Server/ProxmoxServerRepository.php @@ -2,13 +2,13 @@ namespace Convoy\Repositories\Proxmox\Server; +use Convoy\Data\Server\Proxmox\ServerStateData; +use Convoy\Enums\Node\Access\RealmType; +use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException; use Convoy\Models\Server; use Convoy\Models\Template; -use Webmozart\Assert\Assert; -use Convoy\Enums\Node\Access\RealmType; -use Convoy\Data\Server\Proxmox\ServerStateData; use Convoy\Repositories\Proxmox\ProxmoxRepository; -use Convoy\Exceptions\Repository\Proxmox\ProxmoxConnectionException; +use Webmozart\Assert\Assert; class ProxmoxServerRepository extends ProxmoxRepository { @@ -20,12 +20,12 @@ public function getState() Assert::isInstanceOf($this->server, Server::class); $response = $this->getHttpClient() - ->withUrlParameters([ - 'node' => $this->node->cluster, - 'server' => $this->server->vmid, - ]) - ->get('/api2/json/nodes/{node}/qemu/{server}/status/current') - ->json(); + ->withUrlParameters([ + 'node' => $this->node->cluster, + 'server' => $this->server->vmid, + ]) + ->get('/api2/json/nodes/{node}/qemu/{server}/status/current') + ->json(); return ServerStateData::fromRaw($this->getData($response)); } @@ -35,16 +35,17 @@ public function create(Template $template) Assert::isInstanceOf($this->server, Server::class); $response = $this->getHttpClient() - ->withUrlParameters([ - 'node' => $this->node->cluster, - 'template' => $template->vmid, - ]) - ->post('/api2/json/nodes/{node}/qemu/{template}/clone', [ - 'target' => $this->node->cluster, - 'newid' => $this->server->vmid, - 'full' => true, - ]) - ->json(); + ->withUrlParameters([ + 'node' => $this->node->cluster, + 'template' => $template->vmid, + ]) + ->post('/api2/json/nodes/{node}/qemu/{template}/clone', [ + 'storage' => $this->node->vm_storage, + 'target' => $this->node->cluster, + 'newid' => $this->server->vmid, + 'full' => true, + ]) + ->json(); return $this->getData($response); } @@ -59,12 +60,12 @@ public function delete() 'purge' => true, ], ]) - ->withUrlParameters([ - 'node' => $this->node->cluster, - 'server' => $this->server->vmid, - ]) - ->delete('/api2/json/nodes/{node}/qemu/{server}') - ->json(); + ->withUrlParameters([ + 'node' => $this->node->cluster, + 'server' => $this->server->vmid, + ]) + ->delete('/api2/json/nodes/{node}/qemu/{server}') + ->json(); return $this->getData($response); } @@ -74,12 +75,12 @@ public function addUser(RealmType $realmType, string $userId, string $roleId) Assert::isInstanceOf($this->server, Server::class); $response = $this->getHttpClient() - ->put('/api2/json/access/acl', [ - 'path' => '/vms/'.$this->server->vmid, - 'users' => $userId.'@'.$realmType->value, - 'roles' => $roleId, - ]) - ->json(); + ->put('/api2/json/access/acl', [ + 'path' => '/vms/' . $this->server->vmid, + 'users' => $userId . '@' . $realmType->value, + 'roles' => $roleId, + ]) + ->json(); return $this->getData($response); }