public Map<String, String> getConfigurationChanges(Cluster cluster,
                                                     ConfigUpgradePack configUpgradePack) {
    Map<String, String> configParameters = new HashMap<>();

    if (id == null || id.isEmpty()) {
      LOG.warn("Config task id is not defined, skipping config change");
      return configParameters;
    }

    if (configUpgradePack == null) {
      LOG.warn("Config upgrade pack is not defined, skipping config change");
      return configParameters;
    }

    // extract config change definition, referenced by current ConfigureTask
    ConfigUpgradeChangeDefinition definition = configUpgradePack.enumerateConfigChangesByID().get(id);
    if (definition == null) {
      LOG.warn(String.format("Can not resolve config change definition by id %s, " +
              "skipping config change", id));
      return configParameters;
    }

    // this task is not a condition task, so process the other elements normally
    if (null != definition.getConfigType()) {
      configParameters.put(PARAMETER_CONFIG_TYPE, definition.getConfigType());
    }

    // for every <set key=foo value=bar/> add it to this list
    if (null != definition.getKeyValuePairs() && !definition.getKeyValuePairs().isEmpty()) {
      List<ConfigurationKeyValue> allowedSets = getValidSets(cluster, definition.getConfigType(), definition.getKeyValuePairs());
      configParameters.put(ConfigureTask.PARAMETER_KEY_VALUE_PAIRS,
          m_gson.toJson(allowedSets));
    }

    // transfers
    List<Transfer> transfers = definition.getTransfers();
    if (null != transfers && !transfers.isEmpty()) {
      List<Transfer> allowedTransfers = getValidTransfers(cluster, definition.getConfigType(), definition.getTransfers());
      configParameters.put(ConfigureTask.PARAMETER_TRANSFERS, m_gson.toJson(allowedTransfers));
    }

    // replacements

    List<Replace> replacements = new ArrayList<>();
    replacements.addAll(definition.getReplacements());
    //Fetch the replacements that used regex to find a string
    replacements.addAll(definition.getRegexReplacements(cluster));

    if( !replacements.isEmpty() ){
      List<Replace> allowedReplacements = getValidReplacements(cluster, definition.getConfigType(), replacements);
      configParameters.put(ConfigureTask.PARAMETER_REPLACEMENTS, m_gson.toJson(allowedReplacements));
    }

    // inserts
    List<Insert> insertions = definition.getInsertions();
    if (!insertions.isEmpty()) {
      configParameters.put(ConfigureTask.PARAMETER_INSERTIONS, m_gson.toJson(insertions));
    }

    if (StringUtils.isNotEmpty(associatedService)) {
      configParameters.put(ConfigureTask.PARAMETER_ASSOCIATED_SERVICE, associatedService);
    }

    return configParameters;
  }
Gets a map containing the following properties pertaining to the
configuration value to change:
<ul>
<li>{@link #PARAMETER_CONFIG_TYPE} - the configuration type (ie hdfs-site)</li>
<li>{@link #PARAMETER_KEY_VALUE_PAIRS} - key/value pairs for the
configurations</li>
<li>{@link #PARAMETER_KEY_VALUE_PAIRS} - key/value pairs for the
configurations</li>
<li>{@link #PARAMETER_TRANSFERS} - COPY/MOVE/DELETE changes</li>
<li>{@link #PARAMETER_REPLACEMENTS} - value replacements</li>
</ul>

@param cluster
         the cluster to use when retrieving conditional properties to test
         against (not {@code null}).
@return the a map containing the changes to make. This could potentially be
        an empty map if no conditions are met. Callers should decide how to
        handle a configuration task that is unable to set any configuration
        values.
ambari-server/src/main/java/org/apache/ambari/server/stack/upgrade/ConfigureTask.java