private static void waitOnOperation(Supplier<Operation> operationSupplier) { Operation operation = operationSupplier.get(); while (!operation.getStatus().equals("DONE")) { if (operation.getError() != null) { throw new HalException(FATAL, String.join("\n", operation.getError() .getErrors() .stream() .map(e -> e.getCode() + ": " + e.getMessage()).collect(Collectors.toList()))); } operation = operationSupplier.get(); DaemonTaskHandler.safeSleep(TimeUnit.SECONDS.toMillis(1)); } }
private static void waitOnOperation(Supplier<Operation> operationSupplier) { Operation operation = operationSupplier.get(); while (!operation.getStatus().equals("DONE")) { if (operation.getError() != null) { throw new HalException(FATAL, String.join("\n", operation.getError() .getErrors() .stream() .map(e -> e.getCode() + ": " + e.getMessage()).collect(Collectors.toList()))); } operation = operationSupplier.get(); DaemonTaskHandler.safeSleep(TimeUnit.SECONDS.toMillis(1)); } }
static OperationError fromPb( com.google.api.services.compute.model.Operation.Error.Errors errorPb) { return new OperationError(errorPb.getCode(), errorPb.getLocation(), errorPb.getMessage()); }
com.google.api.services.compute.model.Operation.Error.Errors toPb() { return new com.google.api.services.compute.model.Operation.Error.Errors() .setCode(code) .setLocation(location) .setMessage(message); }
static OperationError fromPb( com.google.api.services.compute.model.Operation.Error.Errors errorPb) { return new OperationError(errorPb.getCode(), errorPb.getLocation(), errorPb.getMessage()); }
com.google.api.services.compute.model.Operation.Error.Errors toPb() { return new com.google.api.services.compute.model.Operation.Error.Errors() .setCode(code) .setLocation(location) .setMessage(message); }