private void setConfigurationsOnCluster(List<BlueprintServiceConfigRequest> configurationRequests,
                                         String tag, Set<String> updatedConfigTypes)  {
    String clusterName;
    Cluster cluster;
    try {
      clusterName = ambariContext.getClusterName(clusterTopology.getClusterId());
      cluster = AmbariContext.getController().getClusters().getCluster(clusterName);
    } catch (AmbariException e) {
      LOG.error("Cannot get cluster name for clusterId = " + clusterTopology.getClusterId(), e);
      throw new RuntimeException(e);
    }
    // iterate over services to deploy
    for (BlueprintServiceConfigRequest blueprintConfigRequest : configurationRequests) {
      ClusterRequest clusterRequest = null;
      // iterate over the config types associated with this service
      List<ConfigurationRequest> requestsPerService = new LinkedList<>();
      for (BlueprintServiceConfigElement blueprintElement : blueprintConfigRequest.getConfigElements()) {
        Map<String, Object> clusterProperties = new HashMap<>();
        clusterProperties.put(ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID, clusterName);
        clusterProperties.put(ClusterResourceProvider.CLUSTER_DESIRED_CONFIGS_PROPERTY_ID + "/type", blueprintElement.getTypeName());
        clusterProperties.put(ClusterResourceProvider.CLUSTER_DESIRED_CONFIGS_PROPERTY_ID + "/tag", tag);
        for (Map.Entry<String, String> entry : blueprintElement.getConfiguration().entrySet()) {
          clusterProperties.put(ClusterResourceProvider.CLUSTER_DESIRED_CONFIGS_PROPERTY_ID +
              "/properties/" + entry.getKey(), entry.getValue());
        }
        if (blueprintElement.getAttributes() != null) {
          for (Map.Entry<String, Map<String, String>> attribute : blueprintElement.getAttributes().entrySet()) {
            String attributeName = attribute.getKey();
            for (Map.Entry<String, String> attributeOccurrence : attribute.getValue().entrySet()) {
              clusterProperties.put(ClusterResourceProvider.CLUSTER_DESIRED_CONFIGS_PROPERTY_ID + "/properties_attributes/"
                  + attributeName + "/" + attributeOccurrence.getKey(), attributeOccurrence.getValue());
            }
          }
        }

        // only create one cluster request per service, which includes
        // all the configuration types for that service
        if (clusterRequest == null) {
          SecurityType securityType;
          String requestedSecurityType = (String) clusterProperties.get(
              ClusterResourceProvider.CLUSTER_SECURITY_TYPE_PROPERTY_ID);
          if(requestedSecurityType == null)
            securityType = null;
          else {
            try {
              securityType = SecurityType.valueOf(requestedSecurityType.toUpperCase());
            } catch (IllegalArgumentException e) {
              throw new IllegalArgumentException(String.format(
                  "Cannot set cluster security type to invalid value: %s", requestedSecurityType));
            }
          }

          clusterRequest = new ClusterRequest(
              (Long) clusterProperties.get(ClusterResourceProvider.CLUSTER_ID_PROPERTY_ID),
              (String) clusterProperties.get(ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID),
              (String) clusterProperties.get(ClusterResourceProvider.CLUSTER_PROVISIONING_STATE_PROPERTY_ID),
              securityType,
              (String) clusterProperties.get(ClusterResourceProvider.CLUSTER_VERSION_PROPERTY_ID),
              null);
        }

        List<ConfigurationRequest> listOfRequests = ambariContext.createConfigurationRequests(clusterProperties);
        requestsPerService.addAll(listOfRequests);
      }

      // set total list of config requests, including all config types for this service
      if (clusterRequest != null) {
        clusterRequest.setDesiredConfig(requestsPerService);
        LOG.info("Sending cluster config update request for service = " + blueprintConfigRequest.getServiceName());
        ambariContext.setConfigurationOnCluster(clusterRequest);
      } else {
        LOG.error("ClusterRequest should not be null for service = " + blueprintConfigRequest.getServiceName());
      }
    }
    cluster.refresh();

    ambariContext.notifyAgentsAboutConfigsChanges(clusterName);

    if (tag.equals(TopologyManager.TOPOLOGY_RESOLVED_TAG)) {
      // if this is a request to resolve config, then wait until resolution is completed
      try {
        // wait until the cluster topology configuration is set/resolved
        ambariContext.waitForConfigurationResolution(clusterName, updatedConfigTypes);
      } catch (AmbariException e) {
        LOG.error("Error while attempting to wait for the cluster configuration to reach TOPOLOGY_RESOLVED state.", e);
      }
    }
  }
Creates a ClusterRequest for each service that
  includes any associated config types and configuration. The Blueprints
  implementation will now create one ClusterRequest per service, in order
  to comply with the ServiceConfigVersioning framework in Ambari.

This method will also send these requests to the management controller.

@param configurationRequests a list of requests to send to the AmbariManagementController.
ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java