[#FER-19] Ajouter le healthCheck du pont bascule (!58)
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
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>
This commit was merged in pull request #58.
This commit is contained in:
46
src/ApiResource/PontBasculeHealthCheck.php
Normal file
46
src/ApiResource/PontBasculeHealthCheck.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
}
|
||||
Reference in New Issue
Block a user