Search in sources :

Example 1 with ClouderaManagerStackDetailsV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response in project cloudbreak by hortonworks.

the class ImagesToImagesV4ResponseConverter method convertClouderaManagerStackDetailsToJson.

private ClouderaManagerStackDetailsV4Response convertClouderaManagerStackDetailsToJson(ImageStackDetails stackDetails) {
    ClouderaManagerStackDetailsV4Response json = new ClouderaManagerStackDetailsV4Response();
    json.setVersion(stackDetails.getVersion());
    json.setRepository(convertClouderaManagerStackRepoDetailsToJson(stackDetails.getRepo()));
    json.setStackBuildNumber(stackDetails.getStackBuildNumber());
    return json;
}
Also used : ClouderaManagerStackDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response)

Example 2 with ClouderaManagerStackDetailsV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response 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)

Example 3 with ClouderaManagerStackDetailsV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response in project cloudbreak by hortonworks.

the class ImagesToImagesV4ResponseConverter method getDefaultCdhStackInfo.

private List<ClouderaManagerStackDetailsV4Response> getDefaultCdhStackInfo(Map<String, ImageBasedDefaultCDHInfo> defaultStackInfo) {
    List<ClouderaManagerStackDetailsV4Response> result = new ArrayList<>();
    for (ImageBasedDefaultCDHInfo info : defaultStackInfo.values()) {
        ClouderaManagerStackDetailsV4Response json = new ClouderaManagerStackDetailsV4Response();
        ClouderaManagerStackRepoDetailsV4Response repoJson = new ClouderaManagerStackRepoDetailsV4Response();
        Map<String, String> stackRepo = info.getDefaultCDHInfo().getRepo().getStack();
        if (stackRepo != null) {
            repoJson.setStack(stackRepo);
        }
        json.setRepository(repoJson);
        json.setVersion(info.getDefaultCDHInfo().getVersion());
        result.add(json);
    }
    return result;
}
Also used : ClouderaManagerStackRepoDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackRepoDetailsV4Response) ClouderaManagerStackDetailsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response) ImageBasedDefaultCDHInfo(com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo) ArrayList(java.util.ArrayList)

Aggregations

ClouderaManagerStackDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackDetailsV4Response)3 ClouderaManagerStackRepoDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ClouderaManagerStackRepoDetailsV4Response)2 ImageBasedDefaultCDHInfo (com.sequenceiq.cloudbreak.cloud.model.component.ImageBasedDefaultCDHInfo)2 ArrayList (java.util.ArrayList)2 BaseImageV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseImageV4Response)1 BaseStackDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.BaseStackDetailsV4Response)1 ImageV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImageV4Response)1 ImagesV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.imagecatalog.responses.ImagesV4Response)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 StackType (com.sequenceiq.cloudbreak.cloud.model.component.StackType)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 Component (org.springframework.stereotype.Component)1