diff --git a/composer.json b/composer.json index 9f28144..981003a 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "24unix/bindapi", "description": "manage Bind9 DNS server via REST API", "version": "1.0.9", - "build_number": "373", + "build_number": "374", "authors": [ { "name": "Micha Espey", diff --git a/src/Controller/RequestController.php b/src/Controller/RequestController.php index 02695b7..c70888c 100644 --- a/src/Controller/RequestController.php +++ b/src/Controller/RequestController.php @@ -57,7 +57,6 @@ class RequestController private array $uri; - // server tag private string $baseDir; @@ -110,7 +109,6 @@ class RequestController ) ] )] - private function getVersion(): void { if ($this->validateApiKey()) { @@ -193,79 +191,7 @@ class RequestController } - /** - * @OA\Tag(name = "Server") - * @OA\Get( - * path = "/ping", - * summary = "Returning pong.", - * description = "Can be used to check API or server availability.", - * tags={"Server"}, - * @OA\Response(response = "200", description = "OK"), - * @OA\Response(response = "401", description = "API key is missing or invalid."), - * security={ - * {"Authorization":{"read"}} - * } - * ) - * - * @OA\Tag(name = "Domains") - * @OA\Put( - * path="/domains/{name}", - * summary="Updates a domain.", - * description="Updates a domain. Only supplied fields will be updated, existing won't be affected.", - * tags={"Domains"}, - * @OA\Response(response="200", description="OK"), - * @OA\Response(response = "401", description = "API key is missing or invalid."), - * @OA\Response(response="404", description="Domain not found."), - * security={ - * {"Authorization":{"read":"write"}} - * } - * ) - * @OA\Delete ( - * path="/domains/{name}", - * summary="Deletes a domain.", - * description="Deletes a domain.", - * tags={"Domains"}, - * @OA\Response(response="200", description="OK"), - * @OA\Response(response = "401", description = "API key is missing or invalid."), - * @OA\Response(response="404", description="Domain not found."), - * security={ - * {"Authorization":{"read":"write"}} - * } - * ) - * @param string $requestMethod - * @param array $uri - * - * @return void - */ - #[ - OA\Get( - path: '/domains/{name}', - operationId: 'getSingleDomain', - description: 'Returns information of a single domain specified by its domain name.', - summary: 'Returns a single domain.', - security: [ - ['Authorization' => []] - ], - tags: ['Domains'], - parameters: [ - new OA\Parameter(name: 'name', in: 'path', required: true, schema: new OA\Schema(type: 'string')), - ], - responses: [ - new OA\Response( - response: 200, - description: 'OK' - ), - new OA\Response( - response: 401, - description: 'API key is missing or invalid.' - ), - new OA\Response( - response: 404, - description: 'Domain not found.' - )] - - )] private function validateApiKey(): bool { $headers = array_change_key_case(array: getallheaders(), case: CASE_UPPER); @@ -296,10 +222,33 @@ class RequestController return true; } + #[OA\Get( + path: '/domains/{name}', + operationId: 'getSingleDomain', + description: 'Returns information of a single domain specified by its domain name.', + summary: 'Returns a single domain.', + security: [ + ['Authorization' => []] + ], + tags: ['Domains'], + parameters: [ + new OA\Parameter(name: 'name', in: 'path', required: true, schema: new OA\Schema(type: 'string')), + ], + responses: [ + new OA\Response( + response: 200, + description: 'OK' + ), + new OA\Response( + response: 401, + description: 'API key is missing or invalid.' + ), + new OA\Response( + response: 404, + description: 'Domain not found.' + )] - /** - * @return void - */ + )] private function handleDomainsGetRequest(): void { $name = $this->uri[3] ?? ''; @@ -620,7 +569,6 @@ class RequestController } - private function getDomain(string $host): string { $host = strtolower(string: trim(string: $host));