use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.StackMatrixV4Response 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;
}
Aggregations