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 aStatusindicating 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 JsonObjectgetData()booleanisOk()booleanisProcedureInError()static StatusKO()Creates a status when something bad is detected.static StatusKO(JsonObject data)Creates a status when something bad is detected.static StatusOK()Creates a status when everything is fine.static StatusOK(JsonObject data)Creates a status when everything is fine and adds metadata.StatussetData(JsonObject data)Sets the metadata.StatussetKO()Sets the outcome of the status to KO.StatussetOk(boolean ok)Sets whether or not the current status is positive (UP) or negative (DOWN).StatussetOK()Sets the outcome of the status to OK.StatussetProcedureInError(boolean procedureInError)Sets whether or not the procedure attached to this status has failed (timeout, error...).JsonObjecttoJson()Builds the JSON representation of the currentStatusinstance.
-
-
-
Constructor Detail
-
Status
public Status()
Creates a new instance ofStatuswith 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 ofStatusfrom 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 currentStatusinstance.- 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-truefor UP,falsefor 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-trueif the procedure has not been completed correctly.- Returns:
- the current status
-
-