true));
}
disks.addAll(options.getDisks());
InstanceTemplate instanceTemplate = InstanceTemplate.builder()
.forMachineType(hardware.getUri());
if (options.isEnableNat()) {
instanceTemplate.addNetworkInterface(options.getNetwork().get(), Type.ONE_TO_ONE_NAT);
} else {
instanceTemplate.addNetworkInterface(options.getNetwork().get());
}
instanceTemplate.disks(disks);
LoginCredentials credentials = getFromImageAndOverrideIfRequired(template.getImage(), options);
ImmutableMap.Builder<String, String> metadataBuilder = metatadaFromTemplateOptions.apply(options);
metadataBuilder.put(GCE_IMAGE_METADATA_KEY, template.getImage().getUri().toString());
if (!options.shouldKeepBootDisk()) {
metadataBuilder.put(GCE_DELETE_BOOT_DISK_METADATA_KEY, Boolean.TRUE.toString());
}
instanceTemplate.metadata(metadataBuilder.build());
instanceTemplate.serviceAccounts(options.getServiceAccounts());
final InstanceApi instanceApi = api.getInstanceApiForProject(userProject.get());
final String zone = template.getLocation().getId();
Operation operation = instanceApi.createInZone(name, zone, instanceTemplate);