refs #952. First revision status endpoint ogAgent
testing/ogcore-api/pipeline/head Something is wrong with the build of this commit
Details
testing/ogcore-api/pipeline/head Something is wrong with the build of this commit
Details
parent
4aa03d643e
commit
14ff759309
|
@ -46,17 +46,20 @@ class StatusAction extends AbstractController
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $this->httpClient->request('POST', 'https://'.$client->getIp().':8000/ogAdmClient/status');
|
$response = $this->httpClient->request('POST', 'https://'.$client->getIp().':8000/ogAdmClient/status');
|
||||||
|
|
||||||
|
$client->setStatus('active');
|
||||||
|
$this->entityManager->persist($client);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
} catch (TransportExceptionInterface $e) {
|
} catch (TransportExceptionInterface $e) {
|
||||||
|
|
||||||
$client->setStatus('off');
|
$client->setStatus('off');
|
||||||
$this->entityManager->persist($client);
|
$this->entityManager->persist($client);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR);
|
return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->setStatus('active');
|
|
||||||
$this->entityManager->persist($client);
|
|
||||||
$this->entityManager->flush();
|
|
||||||
|
|
||||||
return new JsonResponse(status: Response::HTTP_OK);
|
return new JsonResponse(status: Response::HTTP_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -64,7 +64,7 @@ final class ClientInput
|
||||||
description: 'El estado del cliente',
|
description: 'El estado del cliente',
|
||||||
example: 'active'
|
example: 'active'
|
||||||
)]
|
)]
|
||||||
public ?string $status = 'power-off';
|
public ?string $status = 'off';
|
||||||
|
|
||||||
#[Assert\NotNull(message: 'validators.organizational_unit.not_null')]
|
#[Assert\NotNull(message: 'validators.organizational_unit.not_null')]
|
||||||
#[Groups(['client:write', 'client:patch'])]
|
#[Groups(['client:write', 'client:patch'])]
|
||||||
|
|
Loading…
Reference in New Issue