diff options
Diffstat (limited to 'policy-healthcheck')
-rw-r--r-- | policy-healthcheck/pom.xml | 7 | ||||
-rw-r--r-- | policy-healthcheck/src/main/java/org/openecomp/policy/drools/healthcheck/RestHealthCheck.java | 39 |
2 files changed, 41 insertions, 5 deletions
diff --git a/policy-healthcheck/pom.xml b/policy-healthcheck/pom.xml index 5a409d4a..913a944c 100644 --- a/policy-healthcheck/pom.xml +++ b/policy-healthcheck/pom.xml @@ -32,7 +32,7 @@ <artifactId>policy-healthcheck</artifactId> <name>policy-healthcheck</name> - <description>Separately loadable module with healthcheck code</description> + <description>Separately loadable module to perform healthchecks of the system</description> <properties> <maven.compiler.source>1.8</maven.compiler.source> @@ -92,6 +92,11 @@ </build> <dependencies> + <dependency> + <groupId>io.swagger</groupId> + <artifactId>swagger-jersey2-jaxrs</artifactId> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.openecomp.policy.drools-pdp</groupId> <artifactId>policy-core</artifactId> 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; } |