Upgrade to E2 API with disconnect-all method
[portal/ric-dashboard.git] / webapp-backend / src / main / java / org / oransc / ric / portal / dashboard / controller / HealthcheckController.java
1 /*-
2  * ========================LICENSE_START=================================
3  * O-RAN-SC
4  * %%
5  * Copyright (C) 2019 AT&T Intellectual Property and Nokia
6  * %%
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ========================LICENSE_END===================================
19  */
20 package org.oransc.ric.portal.dashboard.controller;
21
22 import java.lang.invoke.MethodHandles;
23
24 import org.oransc.ric.portal.dashboard.DashboardApplication;
25 import org.oransc.ric.portal.dashboard.DashboardConstants;
26 import org.oransc.ric.portal.dashboard.model.SuccessTransport;
27 import org.springframework.http.MediaType;
28 import org.springframework.web.bind.annotation.RequestMapping;
29 import org.springframework.web.bind.annotation.RequestMethod;
30 import org.springframework.web.bind.annotation.RestController;
31
32 import io.swagger.annotations.ApiOperation;
33
34 /**
35  * Answers REST requests for the API service health etc.
36  */
37 @RestController
38 @RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/dashboard", produces = MediaType.APPLICATION_JSON_VALUE)
39 public class HealthcheckController {
40
41         @ApiOperation(value = "Checks the health of the application by (TBD).", response = SuccessTransport.class)
42         @RequestMapping(value = DashboardConstants.HEALTHCHECK_PATH, method = RequestMethod.GET)
43         public SuccessTransport getDashblardHealth() {
44                 long count = 0;
45                 return new SuccessTransport(200, "(TBD) reports count is " + count);
46         }
47
48         @ApiOperation(value = "Gets the Dashboard MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
49         @RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET)
50         public SuccessTransport getDashboardVersion() {
51                 return new SuccessTransport(200,
52                                 DashboardApplication.getImplementationVersion(MethodHandles.lookup().lookupClass()));
53         }
54
55 }