1283ac5ac045cea7e447303ef5e702ed5b0f632d
[ccsdk/cds.git] /
1 /*
2  * Copyright © 2019-2020 Orange.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.controller
18
19 import io.swagger.annotations.Api
20 import io.swagger.annotations.ApiOperation
21 import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse
22 import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.HealthCheckService
23 import org.springframework.beans.factory.annotation.Autowired
24 import org.springframework.http.MediaType
25 import org.springframework.http.ResponseEntity
26 import org.springframework.web.bind.annotation.RequestMapping
27 import org.springframework.web.bind.annotation.RequestMethod
28 import org.springframework.web.bind.annotation.ResponseBody
29 import org.springframework.web.bind.annotation.RestController
30
31 @RestController
32 @RequestMapping("/api/v1/health")
33 @Api(value = "/api/v1/health",
34         description = "gather all HealthCheckResponses for HealthChecks known to the runtime")
35 open class HealthCheckController {
36
37     @Autowired
38     lateinit var healthApiService: HealthCheckService
39
40     @RequestMapping(path = [""],
41             method = [RequestMethod.GET],
42             produces = [MediaType.APPLICATION_JSON_VALUE])
43     @ResponseBody
44     @ApiOperation(value = "Health Check", hidden = true)
45     fun getSystemHealthCheckResponse(): ResponseEntity<HealthApiResponse> {
46         return ResponseEntity.ok().body(healthApiService.retrieveSystemStatus())
47     }
48 }