}
@Override
public NodeMetadata apply(Instance input) {
Map<URI, ? extends Image> imagesMap = images.get();
Image image = checkNotNull(imagesMap.get(checkNotNull(input.getImage(), "image")),
"no image for %s. images: %s", input.getImage(), imagesMap.values());
return new NodeMetadataBuilder()
.id(input.getName())
.name(input.getName())
.providerId(input.getId())
.hostname(input.getName())
.imageId(image.getId())
.location(checkNotNull(locations.get().get(input.getZone()), "location for %s", input.getZone()))
.hardware(checkNotNull(hardwares.get().get(input.getMachineType()), "hardware type for %s",
input.getMachineType().toString()))
.operatingSystem(image.getOperatingSystem())
.status(toPortableNodeStatus.get(input.getStatus()))
.tags(input.getTags())
.uri(input.getSelfLink())
.userMetadata(input.getMetadata())
.group(nodeNamingConvention.groupInUniqueNameOrNull(input.getName()))