this.regionMap = checkNotNull(regionMap, "regionMap");
}
@Override
public Image apply(final VirtualMachineTemplate template) {
ImageBuilder builder = new ImageBuilder();
builder.ids(template.getId().toString());
builder.name(template.getName());
builder.description(template.getDescription());
// Location information
Datacenter region = regionMap.get().get(template.unwrap().getIdFromLink(ParentLinkName.DATACENTER));
builder.location(datacenterToLocation.apply(region));
// Only conversions have a status
builder.status(Status.AVAILABLE);
builder.backendStatus(Status.AVAILABLE.name()); // Abiquo images do not
// have a status
RESTLink downloadLink = template.unwrap().searchLink("diskfile");
builder.uri(downloadLink == null ? null : URI.create(downloadLink.getHref()));
// TODO: Operating system not implemented in Abiquo Templates
// TODO: Image credentials still not present in Abiquo template metadata
// Will be added in Abiquo 2.4:
// http://jira.abiquo.com/browse/ABICLOUDPREMIUM-3647
builder.operatingSystem(OperatingSystem.builder().description(template.getName()).build());
return builder.build();
}