Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [x] TU/TI/TF rédigée - [x] TU/TI/TF OK - [x] CHANGELOG modifié Reviewed-on: #58 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\ApiResource;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Get;
|
|
use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation;
|
|
use App\State\PontBasculeHealthProvider;
|
|
use Symfony\Component\Serializer\Attribute\Groups;
|
|
|
|
#[ApiResource(
|
|
operations: [
|
|
new Get(
|
|
uriTemplate: '/pont_bascule/health',
|
|
openapi: new OpenApiOperation(
|
|
summary: 'Pont-bascule health check',
|
|
description: 'Returns the connection state of the pont-bascule. Always 200, even when unreachable.',
|
|
),
|
|
normalizationContext: ['groups' => ['pont_bascule:health:read']],
|
|
security: "is_granted('ROLE_USER')",
|
|
provider: PontBasculeHealthProvider::class,
|
|
),
|
|
],
|
|
)]
|
|
final class PontBasculeHealthCheck
|
|
{
|
|
#[Groups(['pont_bascule:health:read'])]
|
|
public bool $healthy = false;
|
|
|
|
#[Groups(['pont_bascule:health:read'])]
|
|
public bool $ok = false;
|
|
|
|
#[Groups(['pont_bascule:health:read'])]
|
|
public bool $busy = false;
|
|
|
|
#[Groups(['pont_bascule:health:read'])]
|
|
public bool $portConnected = false;
|
|
|
|
#[Groups(['pont_bascule:health:read'])]
|
|
public ?string $portError = null;
|
|
|
|
#[Groups(['pont_bascule:health:read'])]
|
|
public ?string $hostname = null;
|
|
}
|