Phase F
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 10s
CI / Go — node-agent tests (push) Failing after 8s
CI / Go — edge-gateway build (push) Successful in 18s

This commit is contained in:
smueller
2026-06-26 15:05:01 +02:00
parent 333ad1cc7d
commit 15cf302afc
23 changed files with 2116 additions and 8 deletions

View File

@@ -134,6 +134,85 @@ function hexagamecloud_TestConnection(array $params): array
}
}
function hexagamecloud_ListAccounts(array $params): array
{
try {
$client = new HexaGameCloudApiClient($params);
$response = $client->listAccounts();
$accounts = [];
foreach ($response['accounts'] ?? [] as $account) {
$accounts[] = [
'uuid' => $account['externalServiceId'] ?? '',
'domain' => $account['domain'] ?? '',
'username' => $account['username'] ?? '',
'status' => $account['status'] ?? 'Active',
];
}
return $accounts;
} catch (Throwable $exception) {
logModuleCall('hexagamecloud', __FUNCTION__, $params, $exception->getMessage());
return [];
}
}
function hexagamecloud_MetricProvider(array $params)
{
try {
$client = new HexaGameCloudApiClient($params);
$serviceId = (string) $params['serviceid'];
$usage = $client->getServiceUsage($serviceId, hexagamecloud_resolveUsageQuery($params));
return [
'metrics' => $usage['metrics'] ?? [],
];
} catch (Throwable $exception) {
logModuleCall('hexagamecloud', __FUNCTION__, $params, $exception->getMessage());
return ['metrics' => []];
}
}
function hexagamecloud_UsageUpdate(array $params)
{
try {
$client = new HexaGameCloudApiClient($params);
$serviceId = (string) $params['serviceid'];
$usage = $client->getServiceUsage($serviceId, hexagamecloud_resolveUsageQuery($params));
$usageUpdate = $usage['usageUpdate'] ?? [];
return [
'diskusage' => (float) ($usageUpdate['diskUsageGiB'] ?? 0),
'bandwidth' => (float) ($usageUpdate['bandwidthGiB'] ?? 0),
];
} catch (Throwable $exception) {
logModuleCall('hexagamecloud', __FUNCTION__, $params, $exception->getMessage());
return [
'diskusage' => 0,
'bandwidth' => 0,
];
}
}
function hexagamecloud_resolveUsageQuery(array $params): array
{
$query = [];
if (!empty($params['usageperiodstart'])) {
$query['periodStart'] = gmdate('c', strtotime((string) $params['usageperiodstart']));
}
if (!empty($params['usageperiodend'])) {
$query['periodEnd'] = gmdate('c', strtotime((string) $params['usageperiodend']));
}
if (!empty($params['testmode']) || !empty($params['configoption4'])) {
$query['testMode'] = true;
}
return $query;
}
function hexagamecloud_lifecycleAction(array $params, string $action, array $body = []): string
{
try {