@Override
  public void validate(ClusterTopology topology) throws InvalidTopologyException {

    // get the config types form the request
    Set<String> incomingConfigTypes = new HashSet<>(topology.getConfiguration().getAllConfigTypes());

    if (incomingConfigTypes.isEmpty()) {
      LOGGER.debug("No config types to be checked.");
      return;
    }

    Set<String> stackConfigTypes = new HashSet<>(topology.getBlueprint().getStack().getConfiguration().getAllConfigTypes());

    // remove all "valid" config types from the incoming set
    incomingConfigTypes.removeAll(stackConfigTypes);

    if (!incomingConfigTypes.isEmpty()) {
      // there are config types in the request that are not in the stack
      String message = String.format("The following config types are not defined in the stack: %s ", incomingConfigTypes);
      LOGGER.error(message);
      throw new InvalidTopologyException(message);
    }
  }
Validates whether incoming config types (form the blueprint or the cluster creation template) are valid.
A configuration type is considered valid if the stack based on which the cluster is to be created contains such a
config type.
ambari-server/src/main/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidator.java