feat : add Dashboard and EnvironmentHealth API Platform DTOs
This commit is contained in:
24
src/ApiResource/Dashboard.php
Normal file
24
src/ApiResource/Dashboard.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\State\DashboardProvider;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/dashboard',
|
||||
security: "is_granted('ROLE_ADMIN')",
|
||||
provider: DashboardProvider::class,
|
||||
),
|
||||
],
|
||||
)]
|
||||
final class Dashboard
|
||||
{
|
||||
/** @var list<array{name: string, slug: string, giteaUrl: ?string, environments: list<array{id: int, name: string, status: string, version: string}>}> */
|
||||
public array $applications = [];
|
||||
}
|
||||
29
src/ApiResource/EnvironmentHealth.php
Normal file
29
src/ApiResource/EnvironmentHealth.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\State\EnvironmentHealthProvider;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/environments/{id}/health',
|
||||
security: "is_granted('ROLE_ADMIN')",
|
||||
provider: EnvironmentHealthProvider::class,
|
||||
),
|
||||
],
|
||||
)]
|
||||
final class EnvironmentHealth
|
||||
{
|
||||
public string $status = 'not_found';
|
||||
public string $version = '';
|
||||
public string $startedAt = '';
|
||||
public float $cpuPercent = 0.0;
|
||||
public string $memoryUsage = '';
|
||||
public string $memoryLimit = '';
|
||||
public float $memoryPercent = 0.0;
|
||||
}
|
||||
Reference in New Issue
Block a user