2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 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=========================================================
21 package org.onap.policy.drools.healthcheck;
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.Info;
26 import io.swagger.annotations.SwaggerDefinition;
27 import io.swagger.annotations.Tag;
29 import javax.ws.rs.GET;
30 import javax.ws.rs.Path;
31 import javax.ws.rs.Produces;
32 import javax.ws.rs.core.MediaType;
33 import javax.ws.rs.core.Response;
35 import org.onap.policy.drools.healthcheck.HealthCheck.Reports;
39 @Produces(MediaType.APPLICATION_JSON)
42 description = "PDP-D Healthcheck Service",
44 title = "PDP-D Healthcheck"
46 consumes = {MediaType.APPLICATION_JSON},
47 produces = {MediaType.APPLICATION_JSON},
48 schemes = {SwaggerDefinition.Scheme.HTTP},
50 @Tag(name = "pdp-d-healthcheck", description = "Drools PDP Healthcheck Operations")
53 public class RestHealthCheck {
57 @Produces(MediaType.APPLICATION_JSON)
59 value = "Perform a system healthcheck",
60 notes = "Provides healthy status of the PDP-D plus the components defined in its "
61 + "configuration by using a REST interface",
62 response = Reports.class
64 public Response healthcheck() {
65 return Response.status(Response.Status.OK).entity(HealthCheck.monitor.healthCheck()).build();
69 @Path("healthcheck/configuration")
70 @Produces(MediaType.APPLICATION_JSON)
72 value = "Configuration",
73 notes = "Provides the Healthcheck server configuration and monitored REST clients",
74 response = HealthCheck.class
76 public HealthCheck configuration() {
77 return HealthCheck.monitor;