Skip to content

Commit 7f5661f

Browse files
Prophet731claude
andcommitted
Add all missing API endpoints and fix paths to match OpenAPI spec
Fixed paths: - Power endpoints: boot/shutdown/restart/poweroff → power/* - Package: POST change-package → PUT package/{id} - Backup plan: POST backup-plan → PUT backups/plan/{id} - Whitelist: whitelist → networkWhitelist - IPv4 quantity: ipv4/quantity → ipv4Qty - Traffic modify: traffic → modify/traffic - Traffic blocks: traffic-blocks → traffic/blocks - Hypervisor groups: hypervisor-groups → compute/hypervisors/groups New server endpoints: suspend, unsuspend, resetPassword, customXML, modifyName, modifyCpuCores, modifyCpuThrottle, modifyMemory, changeOwner, traffic stats, templates, VNC, listServers, listByUser. New resource builders: Hypervisors, Packages, Users, SSH Keys, IP Blocks, Backups, DNS, Media, Queue, Self Service. Added API_REFERENCE.md generated from OpenAPI spec. 95 tests, 286 assertions - all passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cb9a367 commit 7f5661f

54 files changed

Lines changed: 6088 additions & 46 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

API_REFERENCE.md

Lines changed: 4054 additions & 0 deletions
Large diffs are not rendered by default.

src/Builders/BackupsBuilder.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace EZScale\VirtFusion\Builders;
6+
7+
use EZScale\VirtFusion\DataObjects\Backup;
8+
use EZScale\VirtFusion\HttpClient;
9+
10+
class BackupsBuilder
11+
{
12+
public function __construct(
13+
private readonly HttpClient $http,
14+
) {
15+
}
16+
17+
/**
18+
* @return Backup[]
19+
*/
20+
public function listByServer(int $serverId): array
21+
{
22+
$data = $this->http->request('GET', "backups/server/{$serverId}");
23+
24+
return array_map(
25+
fn(array $item) => Backup::fromArray($item),
26+
$data['data'] ?? [],
27+
);
28+
}
29+
}

src/Builders/DnsBuilder.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace EZScale\VirtFusion\Builders;
6+
7+
use EZScale\VirtFusion\HttpClient;
8+
9+
class DnsBuilder
10+
{
11+
public function __construct(
12+
private readonly HttpClient $http,
13+
) {
14+
}
15+
16+
/**
17+
* @return array<string, mixed>
18+
*/
19+
public function getService(int $serviceId): array
20+
{
21+
$data = $this->http->request('GET', "dns/services/{$serviceId}");
22+
23+
return $data['data'] ?? $data;
24+
}
25+
}

src/Builders/HypervisorGroupBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ public function __construct(
1919

2020
public function get(): HypervisorGroup
2121
{
22-
$data = $this->http->request('GET', "hypervisor-groups/{$this->groupId}");
22+
$data = $this->http->request('GET', "compute/hypervisors/groups/{$this->groupId}");
2323

2424
return HypervisorGroup::fromArray($data['data'] ?? $data);
2525
}
2626

2727
public function resources(int $page = 1): PaginatedResponse
2828
{
29-
$data = $this->http->request('GET', "hypervisor-groups/{$this->groupId}/resources", [
29+
$data = $this->http->request('GET', "compute/hypervisors/groups/{$this->groupId}/resources", [
3030
'query' => ['page' => $page],
3131
]);
3232

src/Builders/HypervisorGroupsBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct(
1717

1818
public function list(int $page = 1): PaginatedResponse
1919
{
20-
$data = $this->http->request('GET', 'hypervisor-groups', [
20+
$data = $this->http->request('GET', 'compute/hypervisors/groups', [
2121
'query' => ['page' => $page],
2222
]);
2323

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace EZScale\VirtFusion\Builders;
6+
7+
use EZScale\VirtFusion\DataObjects\Hypervisor;
8+
use EZScale\VirtFusion\DataObjects\PaginatedResponse;
9+
use EZScale\VirtFusion\HttpClient;
10+
11+
class HypervisorsBuilder
12+
{
13+
public function __construct(
14+
private readonly HttpClient $http,
15+
) {
16+
}
17+
18+
public function list(int $results = 20): PaginatedResponse
19+
{
20+
$data = $this->http->request('GET', 'compute/hypervisors', [
21+
'query' => ['results' => $results],
22+
]);
23+
24+
return PaginatedResponse::fromArray(
25+
$data,
26+
fn(array $item) => Hypervisor::fromArray($item),
27+
);
28+
}
29+
30+
public function get(int $hypervisorId): Hypervisor
31+
{
32+
$data = $this->http->request('GET', "compute/hypervisors/{$hypervisorId}");
33+
34+
return Hypervisor::fromArray($data['data'] ?? $data);
35+
}
36+
37+
public function groups(): HypervisorGroupsBuilder
38+
{
39+
return new HypervisorGroupsBuilder($this->http);
40+
}
41+
}

src/Builders/IpBlocksBuilder.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace EZScale\VirtFusion\Builders;
6+
7+
use EZScale\VirtFusion\DataObjects\ActionResult;
8+
use EZScale\VirtFusion\DataObjects\IpBlock;
9+
use EZScale\VirtFusion\DataObjects\PaginatedResponse;
10+
use EZScale\VirtFusion\HttpClient;
11+
12+
class IpBlocksBuilder
13+
{
14+
public function __construct(
15+
private readonly HttpClient $http,
16+
) {
17+
}
18+
19+
public function list(int $results = 20): PaginatedResponse
20+
{
21+
$data = $this->http->request('GET', 'connectivity/ipblocks', [
22+
'query' => ['results' => $results],
23+
]);
24+
25+
return PaginatedResponse::fromArray(
26+
$data,
27+
fn(array $item) => IpBlock::fromArray($item),
28+
);
29+
}
30+
31+
public function get(int $blockId): IpBlock
32+
{
33+
$data = $this->http->request('GET', "connectivity/ipblocks/{$blockId}");
34+
35+
return IpBlock::fromArray($data['data'] ?? $data);
36+
}
37+
38+
public function addIpv4Range(int $blockId, string $start, string $end): ActionResult
39+
{
40+
$data = $this->http->request('POST', "connectivity/ipblocks/{$blockId}/ipv4", [
41+
'json' => ['type' => 'range', 'start' => $start, 'end' => $end],
42+
]);
43+
44+
return ActionResult::fromArray($data);
45+
}
46+
}

src/Builders/MediaBuilder.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace EZScale\VirtFusion\Builders;
6+
7+
use EZScale\VirtFusion\HttpClient;
8+
9+
class MediaBuilder
10+
{
11+
public function __construct(
12+
private readonly HttpClient $http,
13+
) {
14+
}
15+
16+
/**
17+
* @return array<string, mixed>
18+
*/
19+
public function getIso(int $isoId): array
20+
{
21+
$data = $this->http->request('GET', "media/iso/{$isoId}");
22+
23+
return $data['data'] ?? $data;
24+
}
25+
26+
/**
27+
* @return array<mixed>
28+
*/
29+
public function templatesFromPackageSpec(int $serverPackageId): array
30+
{
31+
$data = $this->http->request('GET', "media/templates/fromServerPackageSpec/{$serverPackageId}");
32+
33+
return $data['data'] ?? [];
34+
}
35+
}

src/Builders/PackagesBuilder.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace EZScale\VirtFusion\Builders;
6+
7+
use EZScale\VirtFusion\DataObjects\Package;
8+
use EZScale\VirtFusion\HttpClient;
9+
10+
class PackagesBuilder
11+
{
12+
public function __construct(
13+
private readonly HttpClient $http,
14+
) {
15+
}
16+
17+
/**
18+
* @return Package[]
19+
*/
20+
public function list(): array
21+
{
22+
$data = $this->http->request('GET', 'packages');
23+
24+
return array_map(
25+
fn(array $item) => Package::fromArray($item),
26+
$data['data'] ?? [],
27+
);
28+
}
29+
30+
public function get(int $packageId): Package
31+
{
32+
$data = $this->http->request('GET', "packages/{$packageId}");
33+
34+
return Package::fromArray($data['data'] ?? $data);
35+
}
36+
}

src/Builders/QueueBuilder.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace EZScale\VirtFusion\Builders;
6+
7+
use EZScale\VirtFusion\HttpClient;
8+
9+
class QueueBuilder
10+
{
11+
public function __construct(
12+
private readonly HttpClient $http,
13+
) {
14+
}
15+
16+
/**
17+
* @return array<string, mixed>
18+
*/
19+
public function get(int $queueId): array
20+
{
21+
$data = $this->http->request('GET', "queue/{$queueId}");
22+
23+
return $data['data'] ?? $data;
24+
}
25+
}

0 commit comments

Comments
 (0)