/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019,2021 Nordix Foundation.
+ * Copyright (C) 2019-2023 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property.
* Modifications Copyright (C) 2021-2022 Bell Canada. All rights reserved.
* ================================================================================
package org.onap.policy.pap.main.rest;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import io.swagger.annotations.Authorization;
import lombok.RequiredArgsConstructor;
import org.onap.policy.common.endpoints.report.HealthCheckReport;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Ram Krishna Verma (ram.krishna.verma@est.tech)
*/
@RestController
-@RequestMapping(path = "/policy/pap/v1")
@RequiredArgsConstructor
-public class HealthCheckRestControllerV1 extends PapRestControllerV1 {
+public class HealthCheckRestControllerV1 extends PapRestControllerV1 implements HealthCheckRestControllerV1Api {
private final HealthCheckProvider provider;
- @GetMapping("healthcheck")
- @ApiOperation(value = "Perform healthcheck",
- notes = "Returns healthy status of the Policy Administration component",
- response = HealthCheckReport.class, authorizations = @Authorization(value = AUTHORIZATION_TYPE))
- @ApiResponses(value = {@ApiResponse(code = AUTHENTICATION_ERROR_CODE, message = AUTHENTICATION_ERROR_MESSAGE),
- @ApiResponse(code = AUTHORIZATION_ERROR_CODE, message = AUTHORIZATION_ERROR_MESSAGE),
- @ApiResponse(code = SERVER_ERROR_CODE, message = SERVER_ERROR_MESSAGE)})
+ @Override
public ResponseEntity<HealthCheckReport> healthcheck() {
var report = provider.performHealthCheck(true);
return ResponseEntity.status(report.getCode()).body(report);