summaryrefslogtreecommitdiffstats
path: root/policy-healthcheck/src/main
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-05-25 16:44:15 -0500
committerJorge Hernandez <jh1730@att.com>2017-05-25 16:44:15 -0500
commit881c32ec109f0fff6f5661940ad035c3dfc0c7d9 (patch)
tree79070ad7386cc9b62cf504ebf62ec8702792be4d /policy-healthcheck/src/main
parentf354096969e91aa2b3dcdc52adcc2bde1b3b0b74 (diff)
[POLICY-16] generic introduction of swagger
On a per-server basis append /swagger.json or /swagger.yaml ie: HTTP GET :6969/swagger.json HTTP GET :9696/swagger.json Resulting specification can be used by swagger clients. Change-Id: I4b1a8b53d50b1528664150934b04e92447e4d4d7 Signed-off-by: Jorge Hernandez <jh1730@att.com>
Diffstat (limited to 'policy-healthcheck/src/main')
-rw-r--r--policy-healthcheck/src/main/java/org/openecomp/policy/drools/healthcheck/RestHealthCheck.java39
1 files changed, 35 insertions, 4 deletions
diff --git a/policy-healthcheck/src/main/java/org/openecomp/policy/drools/healthcheck/RestHealthCheck.java b/policy-healthcheck/src/main/java/org/openecomp/policy/drools/healthcheck/RestHealthCheck.java
index e37e758a..06854042 100644
--- a/policy-healthcheck/src/main/java/org/openecomp/policy/drools/healthcheck/RestHealthCheck.java
+++ b/policy-healthcheck/src/main/java/org/openecomp/policy/drools/healthcheck/RestHealthCheck.java
@@ -4,23 +4,54 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import org.openecomp.policy.drools.healthcheck.HealthCheck.Reports;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.Info;
+import io.swagger.annotations.SwaggerDefinition;
+import io.swagger.annotations.Tag;
+
@Path("/")
+@Api
+@Produces(MediaType.APPLICATION_JSON)
+@SwaggerDefinition(
+ info = @Info(
+ description = "PDP-D Healthcheck Service",
+ version = "v1.0",
+ title = "PDP-D Healthcheck"
+ ),
+ consumes = {MediaType.APPLICATION_JSON},
+ produces = {MediaType.APPLICATION_JSON},
+ schemes = {SwaggerDefinition.Scheme.HTTP},
+ tags = {
+ @Tag(name = "pdp-d-healthcheck", description = "Drools PDP Healthcheck Operations")
+ }
+)
public class RestHealthCheck {
@GET
- @Path("{a:healthcheck|test}")
+ @Path("healthcheck")
@Produces(MediaType.APPLICATION_JSON)
- public Reports healthcheck() {
- Reports reports = HealthCheck.monitor.healthCheck();
- return reports;
+ @ApiOperation(
+ value="Perform a system healthcheck",
+ notes="Provides healthy status of the PDP-D plus the components defined in its configuration by using a REST interface",
+ response=Reports.class
+ )
+ public Response healthcheck() {
+ return Response.status(Response.Status.OK).entity(HealthCheck.monitor.healthCheck()).build();
}
@GET
@Path("healthcheck/configuration")
@Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(
+ value="Configuration",
+ notes="Provides the Healthcheck server configuration and monitored REST clients",
+ response=HealthCheck.class
+ )
public HealthCheck configuration() {
return HealthCheck.monitor;
}