添加 ProxmoxDiskRepository.php
This commit is contained in:
parent
30d03cfd7a
commit
a4e5fbd3d2
31
ProxmoxDiskRepository.php
Normal file
31
ProxmoxDiskRepository.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Convoy\Repositories\Proxmox\Server;
|
||||
|
||||
use Convoy\Enums\Server\DiskInterface;
|
||||
use Convoy\Models\Server;
|
||||
use Convoy\Repositories\Proxmox\ProxmoxRepository;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
class ProxmoxDiskRepository extends ProxmoxRepository
|
||||
{
|
||||
public function resizeDisk(DiskInterface $disk, int $bytes)
|
||||
{
|
||||
Assert::isInstanceOf($this->server, Server::class);
|
||||
|
||||
$kibibytes = floor($bytes / 1024);
|
||||
|
||||
$response = $this->getHttpClient()
|
||||
->withUrlParameters([
|
||||
'node' => $this->node->cluster,
|
||||
'server' => $this->server->vmid,
|
||||
])
|
||||
->put('/api2/json/nodes/{node}/qemu/{server}/resize', [
|
||||
'disk' => $disk->value,
|
||||
'size' => "{$kibibytes}K",
|
||||
])
|
||||
->json();
|
||||
|
||||
return $this->getData($response);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user