use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Versions in project cloudbreak by hortonworks.
the class FreeIpaImageProvider method getImages.
public List<ImageWrapper> getImages(ImageSettingsRequest imageSettings, String region, String platform) {
String imageId = imageSettings.getId();
String catalogUrl = StringUtils.isNotBlank(imageSettings.getCatalog()) ? imageSettings.getCatalog() : defaultCatalogUrl;
String imageOs = StringUtils.isNotBlank(imageSettings.getOs()) ? imageSettings.getOs() : defaultOs;
ImageCatalog cachedImageCatalog = imageCatalogProvider.getImageCatalog(catalogUrl);
List<Image> compatibleImages = findImage(imageId, imageOs, cachedImageCatalog.getImages().getFreeipaImages(), region, platform);
List<String> imagesInVersions = filterFreeIpaVersionsByAppVersion(cachedImageCatalog.getVersions().getFreeIpaVersions()).stream().map(FreeIpaVersions::getImageIds).flatMap(Collection::stream).distinct().collect(Collectors.toList());
LOGGER.debug("Compatible images: {} " + System.lineSeparator() + "Images in versions: {}", compatibleImages, imagesInVersions);
return compatibleImages.stream().filter(image -> imagesInVersions.contains(image.getUuid())).map(image -> new ImageWrapper(image, catalogUrl, null)).collect(Collectors.toList());
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Versions in project cloudbreak by hortonworks.
the class ImageCatalogProvider method getVersions.
private Versions getVersions(ImageCatalog catalog) {
if (catalog.getVersions() == null || catalog.getVersions().getFreeIpaVersions() == null) {
LOGGER.debug("FreeIPA versions are missing from the image catalog, generating it based on the current svc version and on advertised flags.");
List<String> advertisedImageUuids = catalog.getImages().getFreeipaImages().stream().filter(Image::isAdvertised).map(Image::getUuid).collect(Collectors.toList());
List<FreeIpaVersions> versionList = List.of(new FreeIpaVersions(List.of(freeIpaVersion), List.of(), advertisedImageUuids));
Versions versions = new Versions(versionList);
LOGGER.debug("Generated versions: '{}'", versions);
return versions;
} else {
return catalog.getVersions();
}
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Versions in project cloudbreak by hortonworks.
the class ImageCatalogProvider method filterImagesByOsType.
private ImageCatalog filterImagesByOsType(ImageCatalog catalog) {
LOGGER.debug("Filtering images by OS type {}", getEnabledLinuxTypes());
if ((CollectionUtils.isEmpty(getEnabledLinuxTypes()) || Objects.isNull(catalog.getImages())) && Objects.nonNull(catalog.getVersions())) {
return catalog;
}
List<Image> catalogImages = catalog.getImages().getFreeipaImages();
List<Image> filterImages = filterImages(catalogImages, enabledOsPredicate());
List<FreeIpaVersions> filteredVersions = filterVersions(catalog, filterImages);
return new ImageCatalog(new Images(filterImages), new Versions(filteredVersions));
}
Aggregations