Search in sources :

Example 1 with BaseImageV4Response

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);
    }
}
Also used : BaseImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Example 2 with BaseImageV4Response

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);
    }
}
Also used : BaseImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException) TestFailException(com.sequenceiq.it.cloudbreak.exception.TestFailException)

Example 3 with BaseImageV4Response

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;
}
Also used : BaseImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response) BaseImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response) ImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response) ImagesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response)

Example 4 with BaseImageV4Response

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;
}
Also used : BaseImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response) ImageStackDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails) BaseStackDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseStackDetailsV4Response) ClouderaManagerStackDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response) ClouderaManagerStackRepoDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackRepoDetailsV4Response) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails) HashMap(java.util.HashMap) ImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response) ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) StackType(com.sequenceiq.cloudbreak.cloud.model.component.StackType) Collectors(java.util.stream.Collectors) Image(com.sequenceiq.cloudbreak.cloud.model.catalog.Image) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) List(java.util.List) Component(org.springframework.stereotype.Component) Map(java.util.Map) Images(com.sequenceiq.cloudbreak.cloud.model.catalog.Images) ImageBasedDefaultCDHEntries(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHEntries) ImagesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response) ClouderaManagerStackDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response) BaseImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response) HashMap(java.util.HashMap) ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo)

Aggregations

BaseImageV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response)4 ImageV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response)2 ImagesV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response)2 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)2 BaseStackDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseStackDetailsV4Response)1 ClouderaManagerStackDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response)1 ClouderaManagerStackRepoDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackRepoDetailsV4Response)1 Image (com.sequenceiq.cloudbreak.cloud.model.catalog.Image)1 ImageStackDetails (com.sequenceiq.cloudbreak.cloud.model.catalog.ImageStackDetails)1 Images (com.sequenceiq.cloudbreak.cloud.model.catalog.Images)1 StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.catalog.StackRepoDetails)1 ImageBasedDefaultCDHEntries (com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHEntries)1 ImageBasedDefaultCDHInfo (com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo)1 StackType (com.sequenceiq.cloudbreak.cloud.model.component.StackType)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1