@Override public Set<OperatingSystem> listImages() { Set<OperatingSystem> result = Sets.newHashSet(); // add allObjects filtered by the available OS Set<SoftwareDescription> allObjects = api.getSoftwareDescriptionApi().getAllObjects(); for (OperatingSystem os : createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems()) { result.addAll(FluentIterable.from(allObjects) .filter(new IsOperatingSystem()) .filter(new HasSameOsReferenceCode(os.getOperatingSystemReferenceCode())) .transform(new SoftwareDescriptionToOperatingSystem(os.getId())) .toSet()); } return result; }
@Override public Set<OperatingSystem> listImages() { Set<OperatingSystem> result = Sets.newHashSet(); // add allObjects filtered by the available OS Set<SoftwareDescription> allObjects = api.getSoftwareDescriptionApi().getAllObjects(); for (OperatingSystem os : createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems()) { result.addAll(FluentIterable.from(allObjects) .filter(new IsOperatingSystem()) .filter(new HasSameOsReferenceCode(os.getOperatingSystemReferenceCode())) .transform(new SoftwareDescriptionToOperatingSystem(os.getId())) .toSet()); } return result; }
@Override public Set<OperatingSystem> listImages() { Set<OperatingSystem> result = Sets.newHashSet(); // add allObjects filtered by the available OS Set<SoftwareDescription> allObjects = api.getSoftwareDescriptionApi().getAllObjects(); for (OperatingSystem os : createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems()) { result.addAll(FluentIterable.from(allObjects) .filter(new IsOperatingSystem()) .filter(new HasSameOsReferenceCode(os.getOperatingSystemReferenceCode())) .transform(new SoftwareDescriptionToOperatingSystem(os.getId())) .toSet()); } return result; }
.getVirtualGuestOperatingSystems(); for (OperatingSystem os : operatingSystemsAvailable) { final String osReferenceCode = os.getOperatingSystemReferenceCode(); final String osId = os.getId(); result.addAll(
/** * Builds a Json string suitable for sending to the softlayer api * * @param virtualGuest * @return String */ String buildJson(VirtualGuest virtualGuest) { TemplateObject templateObject = null; String hostname = checkNotNull(virtualGuest.getHostname(), "hostname"); String domain = checkNotNull(virtualGuest.getDomain(), "domain"); int startCpus = checkNotNull(virtualGuest.getStartCpus(), "startCpus"); int maxMemory = checkNotNull(virtualGuest.getMaxMemory(), "maxMemory"); boolean localDiskFlag = checkNotNull(virtualGuest.isLocalDiskFlag(), "localDiskFlag"); String datacenterName = checkNotNull(virtualGuest.getDatacenter().getName(), "datacenterName"); Set<NetworkComponent> networkComponents = getNetworkComponents(virtualGuest); if(virtualGuest.getOperatingSystem() != null) { String operatingSystemReferenceCode = checkNotNull(virtualGuest.getOperatingSystem() .getOperatingSystemReferenceCode(), "operatingSystemReferenceCode"); templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true, operatingSystemReferenceCode, null, localDiskFlag, new Datacenter(datacenterName), networkComponents, getBlockDevices(virtualGuest)); } else if(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() != null) { String globalIdentifier = checkNotNull(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() .getGlobalIdentifier(), "blockDeviceTemplateGroup.globalIdentifier"); templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true, null, new BlockDeviceTemplateGroup(globalIdentifier), localDiskFlag, new Datacenter(datacenterName), networkComponents, null); } return json.toJson(ImmutableMap.of("parameters", ImmutableList.<TemplateObject> of(templateObject))); }
.getOperatingSystemReferenceCode(), "operatingSystemReferenceCode"); templateObjectBuilder.operatingSystemReferenceCode(operatingSystemReferenceCode) .blockDevices(getBlockDevices(virtualGuest));
.getOperatingSystemReferenceCode(), "operatingSystemReferenceCode"); templateObjectBuilder.operatingSystemReferenceCode(operatingSystemReferenceCode) .blockDevices(getBlockDevices(virtualGuest));
.getOperatingSystemReferenceCode(), "operatingSystemReferenceCode"); templateObjectBuilder.operatingSystemReferenceCode(operatingSystemReferenceCode) .blockDevices(getBlockDevices(virtualGuest));
Set<OperatingSystem> virtualGuestOperatingSystems = conf.getVirtualGuestOperatingSystems(); OperatingSystem os = Iterables.getOnlyElement(virtualGuestOperatingSystems); assertEquals(os.getOperatingSystemReferenceCode(), osValid.getTemplate().getOperatingSystemReferenceCode());