use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image in project cloudbreak by hortonworks.
the class ImageCatalogGeneratorService method generate.
public GenerateImageCatalogResponse generate(String environmentCrn, String accountId) {
final Stack stack = stackService.getByEnvironmentCrnAndAccountId(environmentCrn, accountId);
MDCBuilder.buildMdcContext(stack);
LOGGER.info("Generating image catalog for environment {} stack {}", environmentCrn, stack.getId());
final ImageCatalog imageCatalog = imageService.generateImageCatalogForStack(stack);
final GenerateImageCatalogResponse response = new GenerateImageCatalogResponse();
response.setImageCatalog(imageCatalog);
return response;
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image 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.Image 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));
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image in project cloudbreak by hortonworks.
the class ImageService method getImageForStack.
private Image getImageForStack(Stack stack) {
final ImageEntity imageEntity = getByStack(stack);
final ImageSettingsRequest imageSettings = imageEntityToImageSettingsRequest(imageEntity);
final ImageWrapper imageWrapper = getImage(imageSettings, stack.getRegion(), getPlatformString(stack));
return imageWrapper.getImage();
}
use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.image.Image in project cloudbreak by hortonworks.
the class StackToDescribeFreeIpaResponseConverter method convert.
public DescribeFreeIpaResponse convert(Stack stack, ImageEntity image, FreeIpa freeIpa, UserSyncStatus userSyncStatus, Boolean includeAllInstances) {
DescribeFreeIpaResponse describeFreeIpaResponse = new DescribeFreeIpaResponse();
describeFreeIpaResponse.setName(stack.getName());
describeFreeIpaResponse.setEnvironmentCrn(stack.getEnvironmentCrn());
describeFreeIpaResponse.setCrn(stack.getResourceCrn());
describeFreeIpaResponse.setCloudPlatform(stack.getCloudPlatform());
describeFreeIpaResponse.setVariant(stack.getPlatformvariant());
describeFreeIpaResponse.setAuthentication(authenticationResponseConverter.convert(stack.getStackAuthentication()));
Optional.ofNullable(image).ifPresent(i -> describeFreeIpaResponse.setImage(imageSettingsResponseConverter.convert(i)));
Optional.ofNullable(freeIpa).ifPresent(f -> describeFreeIpaResponse.setFreeIpa(freeIpaServerResponseConverter.convert(f)));
describeFreeIpaResponse.setNetwork(networkResponseConverter.convert(stack));
describeFreeIpaResponse.setPlacement(convertToPlacementResponse(stack));
describeFreeIpaResponse.setTunnel(stack.getTunnel());
describeFreeIpaResponse.setInstanceGroups(instanceGroupConverter.convert(stack.getInstanceGroups(), includeAllInstances));
describeFreeIpaResponse.setAvailabilityStatus(stackToAvailabilityStatusConverter.convert(stack));
describeFreeIpaResponse.setStatus(stack.getStackStatus().getStatus());
describeFreeIpaResponse.setStatusString(stack.getStackStatus().getStatusString());
describeFreeIpaResponse.setStatusReason(stack.getStackStatus().getStatusReason());
decorateFreeIpaServerResponseWithIps(describeFreeIpaResponse.getFreeIpa(), describeFreeIpaResponse.getInstanceGroups());
decorateFreeIpaServerResponseWithLoadBalancedHost(stack, describeFreeIpaResponse.getFreeIpa(), freeIpa);
describeFreeIpaResponse.setAppVersion(stack.getAppVersion());
decorateWithCloudStorageAndTelemetry(stack, describeFreeIpaResponse);
Optional.ofNullable(userSyncStatus).ifPresent(u -> describeFreeIpaResponse.setUserSyncStatus(userSyncStatusConverter.convert(u)));
return describeFreeIpaResponse;
}
Aggregations