@Override public Set<? extends Image> get() { final Set<Image> images = Sets.newHashSet(); logger.debug(">> providing images"); for (org.jclouds.rimuhosting.miro.domain.Image from : sync.getImageList()) { ImageBuilder builder = new ImageBuilder(); builder.ids(from.getId() + ""); builder.name(from.getDescription()); builder.description(from.getDescription()); builder.operatingSystem(parseOs(from)); builder.status(Status.AVAILABLE); images.add(builder.build()); } logger.debug("<< images(%d)", images.size()); return images; }
@Override public Image apply(VAppTemplate from) { checkNotNull(from, "VAppTemplate"); Envelope ovf = templateToEnvelope.apply(from); ImageBuilder builder = new ImageBuilder(); builder.ids(from.getHref().toASCIIString()); builder.uri(from.getHref()); builder.name(from.getName()); if (from.getVDC() != null) { builder.location(findLocationForResource.apply(from.getVDC())); } else { // otherwise, it could be in a public catalog, which is not assigned to a VDC } builder.description(from.getDescription() != null ? from.getDescription() : from.getName()); builder.operatingSystem(CIMOperatingSystem.toComputeOs(ovf)); builder.status(toPortableImageStatus.get(from.getStatus())); return builder.build(); }
@Override public Image apply(DiskImage from) { checkNotNull(from, "disk image"); ImageBuilder builder = new ImageBuilder(); builder.ids(from.getId()); builder.name(from.getName()); builder.description(from.getDescription()); builder.location(Iterables.getOnlyElement(regionSupplier.get())); // in fgcp, if the image is listed it is available builder.status(Status.AVAILABLE); OperatingSystem os = diskImageToOperatingSystem.apply(from); builder.operatingSystem(os); String user = os.getFamily() == OsFamily.WINDOWS ? "Administrator" : "root"; builder.defaultCredentials(LoginCredentials.builder().identity(user).noPassword().build()); return builder.build(); }