private StackAdvisorRequest createStackAdvisorRequest(ClusterTopology clusterTopology, StackAdvisorRequestType requestType) {
    Stack stack = clusterTopology.getBlueprint().getStack();
    Map<String, Set<String>> hgComponentsMap = gatherHostGroupComponents(clusterTopology);
    Map<String, Set<String>> hgHostsMap = gatherHostGroupBindings(clusterTopology);
    Map<String, Set<String>> componentHostsMap = gatherComponentsHostsMap(hgComponentsMap,
        hgHostsMap);
    return StackAdvisorRequest.StackAdvisorRequestBuilder
      .forStack(stack.getName(), stack.getVersion())
      .forServices(new ArrayList<>(clusterTopology.getBlueprint().getServices()))
      .forHosts(gatherHosts(clusterTopology))
      .forHostsGroupBindings(gatherHostGroupBindings(clusterTopology))
      .forHostComponents(gatherHostGroupComponents(clusterTopology))
      .withComponentHostsMap(componentHostsMap)
      .withConfigurations(calculateConfigs(clusterTopology))
      .withUserContext(userContext)
      .ofType(requestType)
      .build();
  }
Recommend configurations by the stack advisor, then store the results in cluster topology.
@param clusterTopology cluster topology instance
@param userProvidedConfigurations User configurations of cluster provided in Blueprint + Cluster template
ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java