Search in sources :

Example 6 with ClouderaManagerInfoV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response in project cloudbreak by hortonworks.

the class RepoTestUtil method getClouderaManagerInfoResponse.

public static ClouderaManagerInfoV4Response getClouderaManagerInfoResponse(String version) {
    ClouderaManagerInfoV4Response cmResponse = new ClouderaManagerInfoV4Response();
    cmResponse.setVersion(version);
    cmResponse.setRepository(getClouderaManagerRepositoryResponse(version));
    return cmResponse;
}
Also used : ClouderaManagerInfoV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response)

Example 7 with ClouderaManagerInfoV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response in project cloudbreak by hortonworks.

the class DefaultClouderaManagerRepoService method getDefault.

public ClouderaManagerRepo getDefault(String osType, String clusterType, String clusterVersion, String platform) throws CloudbreakImageCatalogException {
    if (StackType.CDH.name().equals(clusterType)) {
        StackMatrixV4Response stackMatrixV4Response = stackMatrixService.getStackMatrix(platform);
        Map<String, ClouderaManagerStackDescriptorV4Response> stackDescriptorMap = stackMatrixV4Response.getCdh();
        if (stackDescriptorMap != null) {
            Optional<Entry<String, ClouderaManagerStackDescriptorV4Response>> descriptorEntry = stackDescriptorMap.entrySet().stream().filter(stackDescriptorEntry -> clusterVersion == null || clusterVersion.equals(stackDescriptorEntry.getKey())).max(Comparator.comparing(Entry::getKey));
            if (descriptorEntry.isPresent()) {
                Entry<String, ClouderaManagerStackDescriptorV4Response> stackDescriptorEntry = descriptorEntry.get();
                ClouderaManagerInfoV4Response clouderaManagerInfoJson = stackDescriptorEntry.getValue().getClouderaManager();
                if (clouderaManagerInfoJson.getRepository().get(osType) != null) {
                    ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
                    clouderaManagerRepo.setPredefined(false);
                    clouderaManagerRepo.setVersion(clouderaManagerInfoJson.getVersion());
                    clouderaManagerRepo.setBaseUrl(clouderaManagerInfoJson.getRepository().get(osType).getBaseUrl());
                    clouderaManagerRepo.setGpgKeyUrl(clouderaManagerInfoJson.getRepository().get(osType).getGpgKeyUrl());
                    return clouderaManagerRepo;
                }
            }
        }
    }
    LOGGER.info("Missing Cloudera Manager Repo information for os: {} clusterType: {} clusterVersion: {}", osType, clusterType, clusterVersion);
    return null;
}
Also used : Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) RepositoryInfo(com.sequenceiq.cloudbreak.cloud.model.component.RepositoryInfo) StackMatrixV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response) HashMap(java.util.HashMap) ClouderaManagerInfoV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response) ClouderaManagerStackDescriptorV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerStackDescriptorV4Response) StackType(com.sequenceiq.cloudbreak.cloud.model.component.StackType) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) Inject(javax.inject.Inject) Service(org.springframework.stereotype.Service) Map(java.util.Map) Entry(java.util.Map.Entry) Optional(java.util.Optional) CloudbreakImageCatalogException(com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException) Comparator(java.util.Comparator) ClouderaManagerInfoV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response) Entry(java.util.Map.Entry) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) ClouderaManagerStackDescriptorV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerStackDescriptorV4Response) StackMatrixV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response)

Aggregations

ClouderaManagerInfoV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerInfoV4Response)7 ClouderaManagerStackDescriptorV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.ClouderaManagerStackDescriptorV4Response)4 StackMatrixV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response)4 RepositoryInfo (com.sequenceiq.cloudbreak.cloud.model.component.RepositoryInfo)4 HashMap (java.util.HashMap)3 Entry (java.util.Map.Entry)3 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)2 StackType (com.sequenceiq.cloudbreak.cloud.model.component.StackType)2 CloudbreakImageCatalogException (com.sequenceiq.cloudbreak.core.CloudbreakImageCatalogException)2 Comparator (java.util.Comparator)2 Map (java.util.Map)2 Optional (java.util.Optional)2 Inject (javax.inject.Inject)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 Service (org.springframework.stereotype.Service)2 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)1 RepositoryDetails (com.sequenceiq.cloudbreak.cloud.model.component.RepositoryDetails)1 ImageCatalogPlatform (com.sequenceiq.cloudbreak.service.image.catalog.model.ImageCatalogPlatform)1 Before (org.junit.Before)1