Skip to content

Commit

Permalink
Add method to retrieve specific component health statuses.
Browse files Browse the repository at this point in the history
Signed-off-by: Yufei Cai <Yufei.Cai@bosch-si.com>
  • Loading branch information
yufei-cai committed Jan 26, 2018
1 parent afa456b commit 3d0b178
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

import org.eclipse.ditto.json.JsonFactory;
import org.eclipse.ditto.json.JsonObject;
Expand Down Expand Up @@ -53,6 +54,16 @@ public HealthStatus getOverallStatus() {
return overallStatus;
}

/**
* Returns the health status of a component if it exists.
*
* @param componentName name of the component.
* @return status of the component if it exists, or an empty optional otherwise.
*/
public Optional<HealthStatus> getComponentStatus(final String componentName) {
return Optional.ofNullable(componentStatuses.get(componentName));
}

/**
* Returns an empty builder.
*
Expand Down

0 comments on commit 3d0b178

Please sign in to comment.