feat : add DatabaseInfo API resource and provider
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
29
src/ApiResource/DatabaseInfo.php
Normal file
29
src/ApiResource/DatabaseInfo.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\DatabaseInfoProvider;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new Get(
|
||||
uriTemplate: '/environments/{id}/database',
|
||||
security: "is_granted('ROLE_ADMIN')",
|
||||
provider: DatabaseInfoProvider::class,
|
||||
),
|
||||
],
|
||||
)]
|
||||
final class DatabaseInfo
|
||||
{
|
||||
public bool $connected = false;
|
||||
public string $name = '';
|
||||
public string $size = '';
|
||||
public int $tableCount = 0;
|
||||
public int $activeConnections = 0;
|
||||
public float $cacheHitRatio = 0.0;
|
||||
public string $largestTable = '';
|
||||
}
|
||||
Reference in New Issue
Block a user