PDO::ERRMODE_EXCEPTION]); } return $pdo; } // Huawei Cloud Regions $HUAWEI_REGIONS = [ 'af-south-1' => 'Africa - Johannesburg', 'ap-southeast-1' => 'Asia Pacific - Hong Kong', 'ap-southeast-2' => 'Asia Pacific - Bangkok', 'ap-southeast-3' => 'Asia Pacific - Singapore', 'cn-east-2' => 'China - Shanghai', 'cn-east-3' => 'China - Shanghai 2', 'cn-north-1' => 'China - Beijing', 'cn-north-4' => 'China - Beijing 4', 'cn-south-1' => 'China - Guangzhou', 'cn-southwest-2' => 'China - Guiyang', 'eu-west-0' => 'Europe - Paris', 'eu-west-101' => 'Europe - Dublin', 'la-north-2' => 'Latin America - Mexico City', 'la-south-2' => 'Latin America - Santiago', 'me-east-1' => 'Middle East - Riyadh', 'na-mexico-1' => 'North America - Mexico', 'ru-northwest-2' => 'Russia - Moscow', 'sa-brazil-1' => 'South America - Sao Paulo', 'tr-west-1' => 'Turkey - Istanbul' ]; // Scaleway Regions & Zones $SCALEWAY_REGIONS = [ 'fr-par' => ['name' => 'France - Paris', 'zones' => ['fr-par-1', 'fr-par-2', 'fr-par-3']], 'nl-ams' => ['name' => 'Netherlands - Amsterdam', 'zones' => ['nl-ams-1', 'nl-ams-2', 'nl-ams-3']], 'pl-waw' => ['name' => 'Poland - Warsaw', 'zones' => ['pl-waw-1', 'pl-waw-2', 'pl-waw-3']] ]; // Scaleway Instance Types $SCALEWAY_INSTANCES = [ 'DEV1-S' => ['vcpus' => 2, 'ram' => 2, 'price' => 0.01], 'DEV1-M' => ['vcpus' => 3, 'ram' => 4, 'price' => 0.02], 'DEV1-L' => ['vcpus' => 4, 'ram' => 8, 'price' => 0.04], 'DEV1-XL' => ['vcpus' => 4, 'ram' => 12, 'price' => 0.06], 'GP1-XS' => ['vcpus' => 4, 'ram' => 16, 'price' => 0.10], 'GP1-S' => ['vcpus' => 8, 'ram' => 32, 'price' => 0.20], 'GP1-M' => ['vcpus' => 16, 'ram' => 64, 'price' => 0.40], 'GP1-L' => ['vcpus' => 32, 'ram' => 128, 'price' => 0.80], 'PLAY2-PICO' => ['vcpus' => 1, 'ram' => 1, 'price' => 0.004], 'PLAY2-NANO' => ['vcpus' => 1, 'ram' => 2, 'price' => 0.008], 'PLAY2-MICRO' => ['vcpus' => 2, 'ram' => 4, 'price' => 0.016], 'STARDUST1-S' => ['vcpus' => 1, 'ram' => 1, 'price' => 0.0025] ]; function ensureTables() { $pdo = getDB(); // Huawei Accounts $pdo->exec("CREATE TABLE IF NOT EXISTS admin.huawei_accounts ( id SERIAL PRIMARY KEY, name VARCHAR(100), access_key VARCHAR(255) NOT NULL, secret_key VARCHAR(255) NOT NULL, project_id VARCHAR(100), region VARCHAR(50) DEFAULT 'eu-west-0', status VARCHAR(50) DEFAULT 'active', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); // Huawei Servers $pdo->exec("CREATE TABLE IF NOT EXISTS admin.huawei_servers ( id SERIAL PRIMARY KEY, account_id INTEGER, server_id VARCHAR(100), name VARCHAR(255), region VARCHAR(50), ip_address VARCHAR(50), private_ip VARCHAR(50), flavor VARCHAR(50), status VARCHAR(50), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); // Scaleway Accounts $pdo->exec("CREATE TABLE IF NOT EXISTS admin.scaleway_accounts ( id SERIAL PRIMARY KEY, name VARCHAR(100), access_key VARCHAR(255) NOT NULL, secret_key VARCHAR(255) NOT NULL, organization_id VARCHAR(100), project_id VARCHAR(100), default_zone VARCHAR(50) DEFAULT 'fr-par-1', status VARCHAR(50) DEFAULT 'active', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); // Scaleway Servers $pdo->exec("CREATE TABLE IF NOT EXISTS admin.scaleway_servers ( id SERIAL PRIMARY KEY, account_id INTEGER, server_id VARCHAR(100), name VARCHAR(255), zone VARCHAR(50), public_ip VARCHAR(50), private_ip VARCHAR(50), instance_type VARCHAR(50), status VARCHAR(50), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); // Cloud IPs Pool $pdo->exec("CREATE TABLE IF NOT EXISTS admin.cloud_ips ( id SERIAL PRIMARY KEY, provider VARCHAR(50), account_id INTEGER, ip_address VARCHAR(50) NOT NULL, region VARCHAR(50), server_id VARCHAR(100), ptr_record VARCHAR(255), status VARCHAR(50) DEFAULT 'available', assigned_to VARCHAR(255), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )"); } // Huawei Cloud API class HuaweiCloudAPI { private $accessKey; private $secretKey; private $projectId; private $region; public function __construct($accountId = null) { if ($accountId) { $pdo = getDB(); $stmt = $pdo->prepare("SELECT * FROM admin.huawei_accounts WHERE id = ?"); $stmt->execute([$accountId]); $acc = $stmt->fetch(PDO::FETCH_ASSOC); $this->accessKey = $acc['access_key']; $this->secretKey = $acc['secret_key']; $this->projectId = $acc['project_id']; $this->region = $acc['region']; } } public function setCredentials($accessKey, $secretKey, $projectId, $region) { $this->accessKey = $accessKey; $this->secretKey = $secretKey; $this->projectId = $projectId; $this->region = $region; } private function sign($method, $url, $headers, $body = '') { $parsedUrl = parse_url($url); $host = $parsedUrl['host']; $path = $parsedUrl['path'] ?? '/'; $query = $parsedUrl['query'] ?? ''; $datetime = gmdate('Ymd\THis\Z'); $date = gmdate('Ymd'); $headers['Host'] = $host; $headers['X-Sdk-Date'] = $datetime; ksort($headers); $signedHeaders = implode(';', array_map('strtolower', array_keys($headers))); $canonicalHeaders = ''; foreach ($headers as $k => $v) { $canonicalHeaders .= strtolower($k) . ':' . trim($v) . "\n"; } $hashedPayload = hash('sha256', $body); $canonicalRequest = "$method\n$path\n$query\n$canonicalHeaders\n$signedHeaders\n$hashedPayload"; $hashedCanonical = hash('sha256', $canonicalRequest); $credentialScope = "$date/{$this->region}/ecs/sdk_request"; $stringToSign = "SDK-HMAC-SHA256\n$datetime\n$credentialScope\n$hashedCanonical"; $kDate = hash_hmac('sha256', $date, "SDK" . $this->secretKey, true); $kRegion = hash_hmac('sha256', $this->region, $kDate, true); $kService = hash_hmac('sha256', 'ecs', $kRegion, true); $kSigning = hash_hmac('sha256', 'sdk_request', $kService, true); $signature = hash_hmac('sha256', $stringToSign, $kSigning); $authorization = "SDK-HMAC-SHA256 Credential={$this->accessKey}/$credentialScope, SignedHeaders=$signedHeaders, Signature=$signature"; $headers['Authorization'] = $authorization; return $headers; } private function request($endpoint, $method = 'GET', $data = null) { $baseUrl = "https://ecs.{$this->region}.myhuaweicloud.com"; $url = $baseUrl . $endpoint; $headers = ['Content-Type' => 'application/json']; $body = $data ? json_encode($data) : ''; $signedHeaders = $this->sign($method, $url, $headers, $body); $ch = curl_init($url); $curlHeaders = []; foreach ($signedHeaders as $k => $v) { $curlHeaders[] = "$k: $v"; } curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $curlHeaders, CURLOPT_CUSTOMREQUEST => $method ]); if ($body && in_array($method, ['POST', 'PUT'])) { curl_setopt($ch, CURLOPT_POSTFIELDS, $body); } $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return ['code' => $httpCode, 'data' => json_decode($response, true)]; } public function listServers() { return $this->request("/v1/{$this->projectId}/cloudservers/detail"); } public function getServer($serverId) { return $this->request("/v1/{$this->projectId}/cloudservers/$serverId"); } public function createServer($name, $flavorId, $imageId, $vpcId, $subnetId, $securityGroupId) { return $this->request("/v1/{$this->projectId}/cloudservers", 'POST', [ 'server' => [ 'name' => $name, 'flavorRef' => $flavorId, 'imageRef' => $imageId, 'vpcid' => $vpcId, 'nics' => [['subnet_id' => $subnetId]], 'security_groups' => [['id' => $securityGroupId]], 'publicip' => ['eip' => ['iptype' => '5_bgp', 'bandwidth' => ['size' => 10, 'sharetype' => 'PER']]] ] ]); } public function deleteServer($serverId) { return $this->request("/v1/{$this->projectId}/cloudservers/delete", 'POST', [ 'servers' => [['id' => $serverId]], 'delete_publicip' => true, 'delete_volume' => true ]); } public function listFlavors() { return $this->request("/v1/{$this->projectId}/cloudservers/flavors"); } public function listImages() { $baseUrl = "https://ims.{$this->region}.myhuaweicloud.com"; // Simplified - returns common images return ['data' => ['images' => [ ['id' => 'ubuntu-20.04', 'name' => 'Ubuntu 20.04'], ['id' => 'ubuntu-22.04', 'name' => 'Ubuntu 22.04'], ['id' => 'centos-7', 'name' => 'CentOS 7'], ['id' => 'debian-11', 'name' => 'Debian 11'] ]]]; } public function serverAction($serverId, $action) { $actions = [ 'start' => ['os-start' => null], 'stop' => ['os-stop' => null], 'reboot' => ['reboot' => ['type' => 'SOFT']] ]; return $this->request("/v1/{$this->projectId}/cloudservers/$serverId/action", 'POST', $actions[$action] ?? []); } } // Scaleway API class ScalewayAPI { private $accessKey; private $secretKey; private $organizationId; private $projectId; private $zone; private $baseUrl = 'https://api.scaleway.com'; public function __construct($accountId = null) { if ($accountId) { $pdo = getDB(); $stmt = $pdo->prepare("SELECT * FROM admin.scaleway_accounts WHERE id = ?"); $stmt->execute([$accountId]); $acc = $stmt->fetch(PDO::FETCH_ASSOC); $this->accessKey = $acc['access_key']; $this->secretKey = $acc['secret_key']; $this->organizationId = $acc['organization_id']; $this->projectId = $acc['project_id']; $this->zone = $acc['default_zone']; } } public function setCredentials($accessKey, $secretKey, $orgId, $projectId, $zone = 'fr-par-1') { $this->accessKey = $accessKey; $this->secretKey = $secretKey; $this->organizationId = $orgId; $this->projectId = $projectId; $this->zone = $zone; } public function setZone($zone) { $this->zone = $zone; } private function request($endpoint, $method = 'GET', $data = null) { $url = $this->baseUrl . $endpoint; $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'X-Auth-Token: ' . $this->secretKey, 'Content-Type: application/json' ], CURLOPT_CUSTOMREQUEST => $method ]); if ($data && in_array($method, ['POST', 'PUT', 'PATCH'])) { curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); } $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return ['code' => $httpCode, 'data' => json_decode($response, true)]; } // Instances public function listServers($zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/servers"); } public function getServer($serverId, $zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/servers/$serverId"); } public function createServer($name, $instanceType, $imageId, $zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/servers", 'POST', [ 'name' => $name, 'commercial_type' => $instanceType, 'image' => $imageId, 'project' => $this->projectId, 'dynamic_ip_required' => true ]); } public function deleteServer($serverId, $zone = null) { $z = $zone ?? $this->zone; // First power off $this->serverAction($serverId, 'poweroff', $z); sleep(5); return $this->request("/instance/v1/zones/$z/servers/$serverId", 'DELETE'); } public function serverAction($serverId, $action, $zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/servers/$serverId/action", 'POST', [ 'action' => $action ]); } // Images public function listImages($zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/images?per_page=50"); } // IPs public function listIPs($zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/ips"); } public function createIP($zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/ips", 'POST', [ 'project' => $this->projectId ]); } public function deleteIP($ipId, $zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/ips/$ipId", 'DELETE'); } public function updateReverseDNS($ipId, $reverse, $zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/ips/$ipId", 'PATCH', [ 'reverse' => $reverse ]); } // Volumes public function listVolumes($zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/volumes"); } // Security Groups public function listSecurityGroups($zone = null) { $z = $zone ?? $this->zone; return $this->request("/instance/v1/zones/$z/security_groups"); } // Bulk Operations public function bulkCreateServers($prefix, $count, $instanceType, $imageId, $zone = null) { $results = []; for ($i = 1; $i <= $count; $i++) { $name = $prefix . '-' . str_pad($i, 3, '0', STR_PAD_LEFT); $results[] = $this->createServer($name, $instanceType, $imageId, $zone); usleep(500000); // 0.5s delay } return $results; } } // API Handler if (isset($_GET['action']) || isset($_POST['action'])) { header('Content-Type: application/json'); ensureTables(); $action = $_GET['action'] ?? $_POST['action']; $pdo = getDB(); try { switch ($action) { case 'stats': echo json_encode(['success' => true, 'stats' => [ 'huawei_accounts' => $pdo->query("SELECT COUNT(*) FROM admin.huawei_accounts")->fetchColumn(), 'huawei_servers' => $pdo->query("SELECT COUNT(*) FROM admin.huawei_servers")->fetchColumn(), 'scaleway_accounts' => $pdo->query("SELECT COUNT(*) FROM admin.scaleway_accounts")->fetchColumn(), 'scaleway_servers' => $pdo->query("SELECT COUNT(*) FROM admin.scaleway_servers")->fetchColumn(), 'total_ips' => $pdo->query("SELECT COUNT(*) FROM admin.cloud_ips")->fetchColumn(), ]]); break; case 'get_regions': global $HUAWEI_REGIONS, $SCALEWAY_REGIONS; echo json_encode(['success' => true, 'huawei' => $HUAWEI_REGIONS, 'scaleway' => $SCALEWAY_REGIONS]); break; case 'get_instance_types': global $SCALEWAY_INSTANCES; echo json_encode(['success' => true, 'scaleway' => $SCALEWAY_INSTANCES]); break; // ========== HUAWEI ========== case 'hw_add_account': $stmt = $pdo->prepare("INSERT INTO admin.huawei_accounts (name, access_key, secret_key, project_id, region) VALUES (?, ?, ?, ?, ?) RETURNING id"); $stmt->execute([ $_POST['name'] ?? 'Huawei Account', $_POST['access_key'], $_POST['secret_key'], $_POST['project_id'], $_POST['region'] ?? 'eu-west-0' ]); echo json_encode(['success' => true, 'id' => $stmt->fetchColumn()]); break; case 'hw_list_accounts': $accounts = $pdo->query("SELECT id, name, region, status, created_at FROM admin.huawei_accounts ORDER BY id")->fetchAll(PDO::FETCH_ASSOC); echo json_encode(['success' => true, 'accounts' => $accounts]); break; case 'hw_delete_account': $pdo->exec("DELETE FROM admin.huawei_accounts WHERE id = " . intval($_POST['id'])); echo json_encode(['success' => true]); break; case 'hw_list_servers': $accountId = $_GET['account_id'] ?? 0; $api = new HuaweiCloudAPI($accountId); $result = $api->listServers(); if ($result['code'] == 200 && isset($result['data']['servers'])) { foreach ($result['data']['servers'] as $srv) { $ip = $srv['addresses'][array_key_first($srv['addresses'])][0]['addr'] ?? ''; $stmt = $pdo->prepare("INSERT INTO admin.huawei_servers (account_id, server_id, name, region, ip_address, status) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT DO NOTHING"); $stmt->execute([$accountId, $srv['id'], $srv['name'], $srv['OS-EXT-AZ:availability_zone'] ?? '', $ip, $srv['status']]); } } echo json_encode(['success' => true, 'servers' => $result['data']['servers'] ?? []]); break; case 'hw_server_action': $accountId = $_POST['account_id'] ?? 0; $serverId = $_POST['server_id'] ?? ''; $act = $_POST['server_action'] ?? ''; $api = new HuaweiCloudAPI($accountId); $result = $api->serverAction($serverId, $act); echo json_encode(['success' => $result['code'] == 200]); break; case 'hw_delete_server': $accountId = $_POST['account_id'] ?? 0; $serverId = $_POST['server_id'] ?? ''; $api = new HuaweiCloudAPI($accountId); $result = $api->deleteServer($serverId); if ($result['code'] == 200) { $pdo->exec("DELETE FROM admin.huawei_servers WHERE server_id = " . $pdo->quote($serverId)); } echo json_encode(['success' => $result['code'] == 200]); break; // ========== SCALEWAY ========== case 'scw_add_account': $stmt = $pdo->prepare("INSERT INTO admin.scaleway_accounts (name, access_key, secret_key, organization_id, project_id, default_zone) VALUES (?, ?, ?, ?, ?, ?) RETURNING id"); $stmt->execute([ $_POST['name'] ?? 'Scaleway Account', $_POST['access_key'], $_POST['secret_key'], $_POST['organization_id'], $_POST['project_id'], $_POST['zone'] ?? 'fr-par-1' ]); echo json_encode(['success' => true, 'id' => $stmt->fetchColumn()]); break; case 'scw_list_accounts': $accounts = $pdo->query("SELECT id, name, default_zone, status, created_at FROM admin.scaleway_accounts ORDER BY id")->fetchAll(PDO::FETCH_ASSOC); echo json_encode(['success' => true, 'accounts' => $accounts]); break; case 'scw_delete_account': $pdo->exec("DELETE FROM admin.scaleway_accounts WHERE id = " . intval($_POST['id'])); echo json_encode(['success' => true]); break; case 'scw_list_servers': $accountId = $_GET['account_id'] ?? 0; $zone = $_GET['zone'] ?? null; $api = new ScalewayAPI($accountId); if ($zone) $api->setZone($zone); $result = $api->listServers($zone); if ($result['code'] == 200 && isset($result['data']['servers'])) { foreach ($result['data']['servers'] as $srv) { $ip = $srv['public_ip']['address'] ?? ''; $stmt = $pdo->prepare("INSERT INTO admin.scaleway_servers (account_id, server_id, name, zone, public_ip, instance_type, status) VALUES (?, ?, ?, ?, ?, ?, ?) ON CONFLICT DO NOTHING"); $stmt->execute([$accountId, $srv['id'], $srv['name'], $srv['zone'], $ip, $srv['commercial_type'], $srv['state']]); } } echo json_encode(['success' => true, 'servers' => $result['data']['servers'] ?? []]); break; case 'scw_create_server': $accountId = $_POST['account_id'] ?? 0; $name = $_POST['name'] ?? 'pmta-' . uniqid(); $type = $_POST['instance_type'] ?? 'DEV1-S'; $image = $_POST['image'] ?? 'ubuntu_focal'; $zone = $_POST['zone'] ?? 'fr-par-1'; $api = new ScalewayAPI($accountId); $result = $api->createServer($name, $type, $image, $zone); if ($result['code'] == 201 && isset($result['data']['server'])) { $srv = $result['data']['server']; $stmt = $pdo->prepare("INSERT INTO admin.scaleway_servers (account_id, server_id, name, zone, instance_type, status) VALUES (?, ?, ?, ?, ?, ?)"); $stmt->execute([$accountId, $srv['id'], $srv['name'], $zone, $type, $srv['state']]); // Power on $api->serverAction($srv['id'], 'poweron', $zone); } echo json_encode(['success' => $result['code'] == 201, 'server' => $result['data']['server'] ?? null]); break; case 'scw_bulk_create': $accountId = $_POST['account_id'] ?? 0; $prefix = $_POST['prefix'] ?? 'pmta'; $count = min(50, intval($_POST['count'] ?? 1)); $type = $_POST['instance_type'] ?? 'DEV1-S'; $image = $_POST['image'] ?? 'ubuntu_focal'; $zone = $_POST['zone'] ?? 'fr-par-1'; $api = new ScalewayAPI($accountId); $results = $api->bulkCreateServers($prefix, $count, $type, $image, $zone); $success = 0; foreach ($results as $r) { if ($r['code'] == 201) { $success++; $srv = $r['data']['server']; $stmt = $pdo->prepare("INSERT INTO admin.scaleway_servers (account_id, server_id, name, zone, instance_type, status) VALUES (?, ?, ?, ?, ?, ?)"); $stmt->execute([$accountId, $srv['id'], $srv['name'], $zone, $type, $srv['state']]); $api->serverAction($srv['id'], 'poweron', $zone); } } echo json_encode(['success' => true, 'created' => $success, 'total' => $count]); break; case 'scw_server_action': $accountId = $_POST['account_id'] ?? 0; $serverId = $_POST['server_id'] ?? ''; $act = $_POST['server_action'] ?? ''; $zone = $_POST['zone'] ?? null; $api = new ScalewayAPI($accountId); $result = $api->serverAction($serverId, $act, $zone); echo json_encode(['success' => in_array($result['code'], [200, 202])]); break; case 'scw_delete_server': $accountId = $_POST['account_id'] ?? 0; $serverId = $_POST['server_id'] ?? ''; $zone = $_POST['zone'] ?? null; $api = new ScalewayAPI($accountId); $result = $api->deleteServer($serverId, $zone); if (in_array($result['code'], [200, 204])) { $pdo->exec("DELETE FROM admin.scaleway_servers WHERE server_id = " . $pdo->quote($serverId)); } echo json_encode(['success' => in_array($result['code'], [200, 204])]); break; case 'scw_list_ips': $accountId = $_GET['account_id'] ?? 0; $zone = $_GET['zone'] ?? null; $api = new ScalewayAPI($accountId); $result = $api->listIPs($zone); echo json_encode(['success' => true, 'ips' => $result['data']['ips'] ?? []]); break; case 'scw_create_ip': $accountId = $_POST['account_id'] ?? 0; $zone = $_POST['zone'] ?? null; $api = new ScalewayAPI($accountId); $result = $api->createIP($zone); if ($result['code'] == 201 && isset($result['data']['ip'])) { $ip = $result['data']['ip']; $stmt = $pdo->prepare("INSERT INTO admin.cloud_ips (provider, account_id, ip_address, region) VALUES ('scaleway', ?, ?, ?)"); $stmt->execute([$accountId, $ip['address'], $zone]); } echo json_encode(['success' => $result['code'] == 201, 'ip' => $result['data']['ip'] ?? null]); break; case 'scw_set_ptr': $accountId = $_POST['account_id'] ?? 0; $ipId = $_POST['ip_id'] ?? ''; $reverse = $_POST['reverse'] ?? ''; $zone = $_POST['zone'] ?? null; $api = new ScalewayAPI($accountId); $result = $api->updateReverseDNS($ipId, $reverse, $zone); echo json_encode(['success' => in_array($result['code'], [200, 201])]); break; case 'scw_list_images': $accountId = $_GET['account_id'] ?? 0; $zone = $_GET['zone'] ?? 'fr-par-1'; $api = new ScalewayAPI($accountId); $result = $api->listImages($zone); echo json_encode(['success' => true, 'images' => $result['data']['images'] ?? []]); break; default: echo json_encode(['success' => false, 'error' => 'Unknown action']); } } catch (Exception $e) { echo json_encode(['success' => false, 'error' => $e->getMessage()]); } exit; } ensureTables(); ?> Cloud Manager - Huawei & Scaleway

Cloud Manager

Huawei Cloud
Scaleway
0
Huawei Accounts
0
Huawei Servers
0
Scaleway Accounts
0
Scaleway Servers
0
Total IPs

Add Huawei Account

Huawei Accounts

IDNameRegionStatusActions

Huawei Servers

Select an account to load servers

Add Scaleway Account

Scaleway Accounts

IDNameZoneStatusActions

Scaleway Servers

Select an account to load servers

IPs Management

IP AddressZoneServerReverse DNSActions