2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.policy.drools.healthcheck;
22 import javax.ws.rs.GET;
23 import javax.ws.rs.Path;
24 import javax.ws.rs.Produces;
25 import javax.ws.rs.core.MediaType;
26 import javax.ws.rs.core.Response;
28 import org.onap.policy.drools.healthcheck.HealthCheck.Reports;
30 import io.swagger.annotations.Api;
31 import io.swagger.annotations.ApiOperation;
32 import io.swagger.annotations.Info;
33 import io.swagger.annotations.SwaggerDefinition;
34 import io.swagger.annotations.Tag;
38 @Produces(MediaType.APPLICATION_JSON)
41 description = "PDP-D Healthcheck Service",
43 title = "PDP-D Healthcheck"
45 consumes = {MediaType.APPLICATION_JSON},
46 produces = {MediaType.APPLICATION_JSON},
47 schemes = {SwaggerDefinition.Scheme.HTTP},
49 @Tag(name = "pdp-d-healthcheck", description = "Drools PDP Healthcheck Operations")
52 public class RestHealthCheck {
56 @Produces(MediaType.APPLICATION_JSON)
58 value="Perform a system healthcheck",
59 notes="Provides healthy status of the PDP-D plus the components defined in its configuration by using a REST interface",
60 response=Reports.class
62 public Response healthcheck() {
63 return Response.status(Response.Status.OK).entity(HealthCheck.monitor.healthCheck()).build();
67 @Path("healthcheck/configuration")
68 @Produces(MediaType.APPLICATION_JSON)
70 value="Configuration",
71 notes="Provides the Healthcheck server configuration and monitored REST clients",
72 response=HealthCheck.class
74 public HealthCheck configuration() {
75 return HealthCheck.monitor;