use of com.redhat.cloud.policies.app.StuffHolder in project policies-ui-backend by RedHatInsights.
the class AdminService method setAdminDown.
/**
* Signal health to outside world. Allowed values for state
* * 'ok': all ok
* * 'degraded': signal instance as degraded on status endpoint
* * 'admin-down': signal health-checks as down. Signals k8s to kill the pod
*/
@Path("/status")
@POST
public Response setAdminDown(@QueryParam("status") Optional<String> status) {
Response.ResponseBuilder builder;
StuffHolder th = StuffHolder.getInstance();
switch(status.orElse("ok")) {
case "ok":
th.setDegraded(false);
th.setAdminDown(false);
builder = Response.ok().entity(new Msg("Reset state to ok"));
break;
case "degraded":
th.setDegraded(true);
builder = Response.ok().entity(new Msg("Set degraded state"));
break;
case "admin-down":
th.setAdminDown(true);
builder = Response.ok().entity(new Msg("Set admin down state"));
break;
default:
builder = Response.status(Response.Status.BAD_REQUEST).entity(new Msg("Unknown status passed"));
}
statusProducer.update();
return builder.build();
}
Aggregations