new com.google.api.services.compute.model.Operation.Error() .setErrors(Lists.transform(errors, OperationError.TO_PB_FUNCTION)));
System.out.println("Success!"); } else { System.out.println(error.toPrettyString());
operationPb.setError(new com.google.api.services.compute.model.Operation.Error().setErrors( Lists.transform(errors, OperationError.TO_PB_FUNCTION)));
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)); } }