Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace classes;
|
|
|
|
use Exception;
|
|
|
|
class edge_gateway_view_service
|
|
{
|
|
public function __construct(private readonly ?edge_gateway_manager $manager = null)
|
|
{
|
|
edge_gateway_schema_bootstrap::ensureTables();
|
|
}
|
|
|
|
/**
|
|
* @return array<int,array<string,mixed>>
|
|
* @throws Exception
|
|
*/
|
|
public function listGateways(?int $departmentId = null, bool $includeDetail = true): array
|
|
{
|
|
return $this->manager()->listGateways($departmentId, $includeDetail);
|
|
}
|
|
|
|
/**
|
|
* @param array<int,array<string,mixed>> $gateways
|
|
* @return array<string,mixed>
|
|
* @throws Exception
|
|
*/
|
|
public function buildFleetUsageStatistics(?int $departmentId = null, array $gateways = []): array
|
|
{
|
|
return $this->manager()->buildFleetUsageStatistics($departmentId, $gateways);
|
|
}
|
|
|
|
/**
|
|
* @throws Exception
|
|
*/
|
|
public function getGateway(int $gatewayId): array
|
|
{
|
|
return $this->manager()->getGateway($gatewayId);
|
|
}
|
|
|
|
private function manager(): edge_gateway_manager
|
|
{
|
|
return $this->manager ?? new edge_gateway_manager();
|
|
}
|
|
}
|