v1.0 Initial commit of project

This commit is contained in:
2026-01-01 10:54:18 +01:00
commit 768cf78b57
990 changed files with 241213 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
use api\classes\API_servers;
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_servers.php';
$API_servers = new API_servers();
if ($API_servers->request_method === 'POST') {
$API_servers->checkPermissions('servers', 'RW');
$requiredFields = [
'server_vm_id' => ['type' => 'string'],
];
$optionalFields = [
'server_vm_host_id' => ['type' => 'string'],
'server_vm_host_name' => ['type' => 'string'],
'company_uuid' => ['type' => 'string'],
'server_power_state' => ['type' => 'enum', 'values' => ['Running', 'Off']],
'server_state' => ['type' => 'enum', 'values' => ['new', 'active', 'deleted', 'trial', 'disabled']],
'server_hostname' => ['type' => 'string'],
'server_os' => ['type' => 'string'],
'server_cpu' => ['type' => 'int'],
'server_memory' => ['type' => 'int'],
'server_memory_demand' => ['type' => 'int'],
'server_disks' => ['type' => 'json'],
'server_ipv4' => ['type' => 'json'],
'server_ipv6' => ['type' => 'json'],
'server_vm_generation' => ['type' => 'int'],
'server_vm_snapshot' => ['type' => 'int'],
'server_licenses' => ['type' => 'json'],
'server_backup' => ['type' => 'json'],
'server_description' => ['type' => 'string'],
];
if (isset($API_servers->postedData['servers'])) {
// multiple servers are posted
$allServers = $API_servers->postedData['servers'];
foreach ($allServers as $server) {
$API_servers->processServerData($server, $requiredFields, $optionalFields);
}
} else {
// Single server update
$API_servers->processServerData($API_servers->postedData, $requiredFields, $optionalFields);
}
$API_servers->apiOutput(200, ['success' => "Server(s) modified or updated successfully."]);
}