From 1e2947b183067859a926f2f01261863753de9395 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Tue, 8 Oct 2024 16:39:10 +0200 Subject: [PATCH] Added UDS info endpoint --- .../UDS/OrganizationalUnitController.php | 28 ++++++++++++++++++ src/OpenApi/OpenApiFactory.php | 29 ++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/Controller/UDS/OrganizationalUnitController.php b/src/Controller/UDS/OrganizationalUnitController.php index e68c0e8..4657bdf 100644 --- a/src/Controller/UDS/OrganizationalUnitController.php +++ b/src/Controller/UDS/OrganizationalUnitController.php @@ -84,4 +84,32 @@ class OrganizationalUnitController extends AbstractController return new JsonResponse($data, Response::HTTP_OK); } + + #[Route('/opengnsys/rest//info', methods: ['GET'])] + public function getOpengnsysInfo(): JsonResponse + { + $data = [ + "project" => "OpenGnsys", + "version" => "1.1.1d", + "codename" => "Espeto", + "definition" => "http://www.andalucia.com/gastronomy/espeto.htm", + "release" => "", + "ogagent" => "1.1.2", + "services" => [ + "server", + "repository" + ], + "oglive" => + [ + "distribution" => "focal", + "kernel" => "5.13.0-27-beta", + "architecture" => "amd64", + "revision" => "r20210706", + "directory" => "ogLive-5.13.0-r20210706", + "iso" => "ogLive-focal-5.13.0-27-beta-amd64-r20210706.5b4bf5f.iso" + ] + ]; + + return new JsonResponse($data, Response::HTTP_OK); + } } \ No newline at end of file diff --git a/src/OpenApi/OpenApiFactory.php b/src/OpenApi/OpenApiFactory.php index 76165c1..5587cd3 100644 --- a/src/OpenApi/OpenApiFactory.php +++ b/src/OpenApi/OpenApiFactory.php @@ -785,8 +785,35 @@ final readonly class OpenApiFactory implements OpenApiFactoryInterface ] ]) )); - } + $openApi->getPaths()->addPath('/opengnsys/rest//info', (new Model\PathItem())->withGet( + (new Model\Operation('getOpengnsysInfo')) + ->withTags(['General']) + ->withSummary('Obtener información general de OpenGnsys') + ->withResponses([ + Response::HTTP_OK => [ + 'description' => 'Información general de OpenGnsys', + 'content' => [ + 'application/json' => [ + 'schema' => [ + 'type' => 'object', + 'properties' => [ + 'project' => [ + 'type' => 'string', + 'example' => 'OpenGnsys', + ], + 'version' => [ + 'type' => 'string', + 'example' => '1.1.1d', + ], + ], + ], + ], + ], + ] + ]) + )); + } private function addInstallOgLiveWebhookEndpoint(OpenApi $openApi): void {