This class tests to see if a Server or ServerCreated has reached a desired status. This class is most useful when paired with a RetryablePredicate as in the code below. Together these classes can be used to block execution until the Server or ServerCreated has reached that desired status. This is useful when your Server needs to be 100% ready before you can continue with execution.
For example, you can use the factory methods like so.
{@code ServerCreated serverCreated = serverApi.create("my-server", image.getId(), flavor.getId());}if (!ServerPredicates.awaitActive(serverApi).apply(serverCreated.getId())) throw new TimeoutException("Timeout on server: " + serverCreated); }
{@code}if (!ServerPredicates.awaitStatus(serverApi, ACTIVE, 300, 2).apply(server.getId())) throw new TimeoutException("Timeout on server: " + serverCreated); }