private static void checkFlattenedConfig(Collection<? extends Map<String, ?>> configs) {
    configs.forEach( config -> {
      if ( !config.isEmpty() ) {
        List<String> firstKey = splitConfigurationKey(config.keySet().iterator().next());
        String configType = firstKey.get(0);
        boolean legacyConfig = isKeyInLegacyFormat(firstKey);

        config.keySet().forEach( key -> {
          List<String> keyParts = splitConfigurationKey(key);
          checkArgument(Objects.equals(configType, keyParts.get(0)),
            "Invalid config type: %s. Should be: %s", keyParts.get(0), configType);
          checkArgument(legacyConfig && isKeyInLegacyFormat(keyParts) || !legacyConfig && isKeyInNewFormat(keyParts),
            "Expected key in %s format, found [%s]",
            legacyConfig ? "[config_type/property_name]" :
              "[config_type/properties/config_name] or [config_type/properties_attributes/attribute_name/property_name]",
            key);
        });
      }
    });
  }
Converts {@link Configuration} objects to a collection easily serializable to Json
@param configuration the configuration to convert
@return the resulting collection
ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurableHelper.java