Minor refactoring.
This commit is contained in:
parent
db7fbe2b7c
commit
15ac0721a6
3 changed files with 19 additions and 24 deletions
|
|
@ -268,6 +268,21 @@ public class VmDefinition {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a condition's status.
|
||||
*
|
||||
* @param name the condition's name
|
||||
* @return the status, if the condition is defined
|
||||
*/
|
||||
public Optional<Boolean> conditionStatus(String name) {
|
||||
return this.<List<Map<String, Object>>> fromStatus("conditions")
|
||||
.orElse(Collections.emptyList()).stream()
|
||||
.filter(cond -> DataPath.get(cond, "type")
|
||||
.map(name::equals).orElse(false))
|
||||
.findFirst().map(cond -> DataPath.get(cond, "status")
|
||||
.map("True"::equals).orElse(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extra data (locally used, unknown to kubernetes).
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue