use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response in project cloudbreak by hortonworks.
the class AbstractCloudProvider method getLatestBaseImage.
public String getLatestBaseImage(ImageCatalogTestDto imageCatalogTestDto, CloudbreakClient cloudbreakClient, String platform) {
try {
List<BaseImageV4Response> images = cloudbreakClient.getDefaultClient().imageCatalogV4Endpoint().getImagesByName(cloudbreakClient.getWorkspaceId(), imageCatalogTestDto.getRequest().getName(), null, platform, null, null).getBaseImages();
if (images.size() == 0) {
throw new IllegalStateException("Images are empty, there is not any base image on provider " + platform);
}
BaseImageV4Response baseImage = images.get(images.size() - 1);
Log.log(LOGGER, format(" Image Catalog Name: %s ", imageCatalogTestDto.getRequest().getName()));
Log.log(LOGGER, format(" Image Catalog URL: %s ", imageCatalogTestDto.getRequest().getUrl()));
Log.log(LOGGER, format(" Selected Base Image Date: %s | ID: %s | Description: %s ", baseImage.getDate(), baseImage.getUuid(), baseImage.getDescription()));
return baseImage.getUuid();
} catch (Exception e) {
LOGGER.error("Cannot fetch base images of {} image catalog, because of {}", imageCatalogTestDto.getRequest().getName(), e);
throw new TestFailException(" Cannot fetch base images of " + imageCatalogTestDto.getRequest().getName() + " image catalog", e);
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response in project cloudbreak by hortonworks.
the class AbstractCloudProvider method getLatestBaseImage.
public String getLatestBaseImage(ImageCatalogTestDto imageCatalogTestDto, CloudbreakClient cloudbreakClient, String platform, boolean govCloud) {
try {
List<BaseImageV4Response> images = cloudbreakClient.getDefaultClient().imageCatalogV4Endpoint().getImagesByName(cloudbreakClient.getWorkspaceId(), imageCatalogTestDto.getRequest().getName(), null, platform, null, null, govCloud).getBaseImages();
if (images.size() == 0) {
throw new IllegalStateException("Images are empty, there is not any base image on provider " + platform);
}
BaseImageV4Response baseImage = images.get(images.size() - 1);
Log.log(LOGGER, format(" Image Catalog Name: %s ", imageCatalogTestDto.getRequest().getName()));
Log.log(LOGGER, format(" Image Catalog URL: %s ", imageCatalogTestDto.getRequest().getUrl()));
Log.log(LOGGER, format(" Selected Base Image Date: %s | ID: %s | Description: %s ", baseImage.getDate(), baseImage.getUuid(), baseImage.getDescription()));
return baseImage.getUuid();
} catch (Exception e) {
LOGGER.error("Cannot fetch base images of {} image catalog, because of {}", imageCatalogTestDto.getRequest().getName(), e);
throw new TestFailException(" Cannot fetch base images of " + imageCatalogTestDto.getRequest().getName() + " image catalog", e);
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response in project cloudbreak by hortonworks.
the class ImagesToImagesV4ResponseConverter method convert.
public ImagesV4Response convert(Images source) {
ImagesV4Response res = new ImagesV4Response();
List<BaseImageV4Response> baseImages = getBaseImageResponses(source);
res.setBaseImages(baseImages);
List<ImageV4Response> cdhImages = convertImages(source.getCdhImages(), StackType.CDH);
res.setCdhImages(cdhImages);
res.setSupportedVersions(source.getSuppertedVersions());
res.setFreeipaImages(source.getFreeIpaImages().stream().map(image -> imageToImageV4ResponseConverter.convert(image)).collect(Collectors.toList()));
return res;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response in project cloudbreak by hortonworks.
the class ImagesToImagesV4ResponseConverter method getBaseImageResponses.
private List<BaseImageV4Response> getBaseImageResponses(Images source) {
Map<String, ImageBasedDefaultCDHInfo> imageBasedDefaultCDHInfoMap = imageBasedDefaultCDHEntries.getEntries(source);
List<ClouderaManagerStackDetailsV4Response> defaultCdhStacks = getDefaultCdhStackInfo(imageBasedDefaultCDHInfoMap);
List<BaseImageV4Response> baseImages = source.getBaseImages().stream().map(image -> {
BaseImageV4Response imgJson = new BaseImageV4Response();
copyImageFieldsToJson(image, imgJson);
imgJson.setCdhStacks(defaultCdhStacks);
imgJson.setRepository(new HashMap<>());
return imgJson;
}).collect(Collectors.toList());
return baseImages;
}
Aggregations