Search in sources :

Example 6 with ServiceComponent

use of com.sequenceiq.cloudbreak.template.model.ServiceComponent in project cloudbreak by hortonworks.

the class ClusterDiagnosticsService method getClusterComponents.

public List<String> getClusterComponents(String stackCrn) {
    List<String> components = new ArrayList<>();
    Stack stack = stackService.getByCrn(stackCrn);
    if (stack != null) {
        Cluster cluster = stack.getCluster();
        if (cluster != null && cluster.getBlueprint() != null) {
            CmTemplateProcessor cmTemplateProcessor = cmTemplateProcessorFactory.get(cluster.getBlueprint().getBlueprintText());
            components = cmTemplateProcessor.getAllComponents().stream().map(ServiceComponent::getComponent).collect(Collectors.toCollection(ArrayList::new));
        }
    }
    return components;
}
Also used : ServiceComponent(com.sequenceiq.cloudbreak.template.model.ServiceComponent) ArrayList(java.util.ArrayList) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Aggregations

ServiceComponent (com.sequenceiq.cloudbreak.template.model.ServiceComponent)6 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 ApiClusterTemplateHostTemplate (com.cloudera.api.swagger.model.ApiClusterTemplateHostTemplate)3 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)3 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)3 List (java.util.List)3 Set (java.util.Set)3 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)2 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 StackType (com.sequenceiq.cloudbreak.api.endpoint.v4.common.StackType)2 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)2 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)2 HashSet (java.util.HashSet)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Collectors.toMap (java.util.stream.Collectors.toMap)2