use of com.sequenceiq.cloudbreak.converter.v4.stacks.cluster.clouderamanager.ClouderaManagerRepositoryV4RequestToClouderaManagerRepoConverter in project cloudbreak by hortonworks.
the class ClusterV4RequestToClusterConverter method extractClusterManagerAndHdpRepoConfig.
private void extractClusterManagerAndHdpRepoConfig(Cluster cluster, ClusterV4Request clusterRequest) {
Set<ClusterComponent> components = new HashSet<>();
ClouderaManagerV4Request clouderaManagerRequest = clusterRequest.getCm();
if (Objects.nonNull(clouderaManagerRequest) && cluster.getBlueprint() != null && !StackType.CDH.name().equals(cluster.getBlueprint().getStackType())) {
throw new BadRequestException("Cannot process the provided Ambari blueprint with Cloudera Manager");
}
Optional.ofNullable(clouderaManagerRequest).map(ClouderaManagerV4Request::getRepository).map(ClouderaManagerRepositoryV4RequestToClouderaManagerRepoConverter::convert).map(toJsonWrapException()).map(cmRepoJson -> new ClusterComponent(ComponentType.CM_REPO_DETAILS, cmRepoJson, cluster)).ifPresent(components::add);
Optional.ofNullable(clouderaManagerRequest).map(ClouderaManagerV4Request::getProducts).orElseGet(List::of).stream().map(this::convertCMProductRequestToCMProduct).map(product -> {
Json json = toJsonWrapException().apply(product);
return new ClusterComponent(ComponentType.CDH_PRODUCT_DETAILS, product.getName(), json, cluster);
}).forEach(components::add);
cluster.setComponents(components);
}
Aggregations