VApp vAppResponse = client.instantiateVAppTemplateInVDC(VDC, templateId, name, options);
logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
if (options.shouldDeploy()) {
logger.debug(">> deploying vApp(%s)", vAppResponse.getName());
Task task = client.deployVApp(vAppResponse.getHref());
if (options.shouldBlock()) {
if (!taskTester.apply(task.getHref())) {
throw new RuntimeException(String.format("failed to %s %s: %s", "deploy", vAppResponse.getName(), task));
}
logger.debug("<< deployed vApp(%s)", vAppResponse.getName());
if (options.shouldPowerOn()) {
logger.debug(">> powering vApp(%s)", vAppResponse.getName());
task = client.powerOnVApp(vAppResponse.getHref());
if (!taskTester.apply(task.getHref())) {
throw new RuntimeException(String.format("failed to %s %s: %s", "powerOn", vAppResponse.getName(),
task));
}
logger.debug("<< on vApp(%s)", vAppResponse.getName());
}