@Override public boolean apply(NicRef input) { checkNotNull(input, "NicRef "); Nic nice = api.nicApi().get(input.dataCenterId(), input.serverId(), input.nicId()); if (nice == null || nice.metadata() == null || nice.metadata().state() == null) { return false; } return nice.metadata().state().toString().equals(expectedState.toString()); }
@Override public boolean apply(String input) { checkNotNull(input, "snapshot id"); return api.snapshotApi() .get(input) .metadata() .state() .toString() .equals(expectedState.toString()); }
@Override public boolean apply(VolumeRef input) { checkNotNull(input, "Volume REF"); org.apache.jclouds.profitbricks.rest.domain.Volume volume = api.volumeApi().getVolume(input.dataCenterId(), input.volumeId()); if (volume == null || volume.metadata() == null || volume.metadata().state() == null) { return false; } return volume.metadata().state().toString().equals(expectedState.toString()); }
@Override public boolean apply(ServerRef serverRef) { checkNotNull(serverRef, "serverRef"); // give time for the operation to actually start Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS); Server server = api.serverApi().getServer(serverRef.dataCenterId(), serverRef.serverId()); if (server == null || server.metadata() == null) { return false; } return server.metadata().state().toString().equals(expectedState.toString()); }