Package io.vertx.ext.healthchecks
Class Status
- java.lang.Object
-
- io.vertx.ext.healthchecks.Status
-
public class Status extends Object
Represents the outcome of a health check procedure. Each procedure produces aStatus
indicating either OK or KO. Optionally, it can also provide additional data.- Author:
- Clement Escoffier
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonObject
getData()
boolean
isOk()
boolean
isProcedureInError()
static Status
KO()
Creates a status when something bad is detected.static Status
KO(JsonObject data)
Creates a status when something bad is detected.static Status
OK()
Creates a status when everything is fine.static Status
OK(JsonObject data)
Creates a status when everything is fine and adds metadata.Status
setData(JsonObject data)
Sets the metadata.Status
setKO()
Sets the outcome of the status to KO.Status
setOk(boolean ok)
Sets whether or not the current status is positive (UP) or negative (DOWN).Status
setOK()
Sets the outcome of the status to OK.Status
setProcedureInError(boolean procedureInError)
Sets whether or not the procedure attached to this status has failed (timeout, error...).JsonObject
toJson()
Builds the JSON representation of the currentStatus
instance.
-
-
-
Constructor Detail
-
Status
public Status()
Creates a new instance ofStatus
with default values.
-
Status
public Status(Status other)
- Parameters:
other
- the status to copy, must not benull
-
Status
public Status(JsonObject json)
Creates a new instance ofStatus
from the given JSON structure.- Parameters:
json
- the serialized form, must not benull
-
-
Method Detail
-
OK
public static Status OK(JsonObject data)
Creates a status when everything is fine and adds metadata.- Returns:
- the created
Status
-
KO
public static Status KO()
Creates a status when something bad is detected.- Returns:
- the created
Status
-
KO
public static Status KO(JsonObject data)
Creates a status when something bad is detected. Also add some metadata.- Returns:
- the created
Status
-
toJson
public JsonObject toJson()
Builds the JSON representation of the currentStatus
instance.- Returns:
- the json object
-
isOk
public boolean isOk()
- Returns:
- whether or not the current status is positive or negative.
-
setOk
public Status setOk(boolean ok)
Sets whether or not the current status is positive (UP) or negative (DOWN).- Parameters:
ok
-true
for UP,false
for DOWN- Returns:
- the current status
-
setKO
public Status setKO()
Sets the outcome of the status to KO.- Returns:
- the current status
-
setOK
public Status setOK()
Sets the outcome of the status to OK.- Returns:
- the current status
-
getData
public JsonObject getData()
- Returns:
- the additional metadata.
-
setData
public Status setData(JsonObject data)
Sets the metadata.- Parameters:
data
- the data- Returns:
- the current status
-
isProcedureInError
public boolean isProcedureInError()
- Returns:
- whether or not the status denotes a failure of a procedure.
-
setProcedureInError
public Status setProcedureInError(boolean procedureInError)
Sets whether or not the procedure attached to this status has failed (timeout, error...).- Parameters:
procedureInError
-true
if the procedure has not been completed correctly.- Returns:
- the current status
-
-