Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Extract exposed ports from docker inspect and show them as badges (hostPort:containerPort) in the environment health section. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
811 B
PHP
32 lines
811 B
PHP
<?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;
|
|
/** @var list<array{hostPort: string, containerPort: string, protocol: string}> */
|
|
public array $ports = [];
|
|
}
|