@Override
  public ConfigGroupResponse convertToResponse() throws AmbariException {
    Set<Map<String, Object>> hostnames = new HashSet<>();
    for (Host host : m_hosts.values()) {
      Map<String, Object> hostMap = new HashMap<>();
      hostMap.put("host_name", host.getHostName());
      hostnames.add(hostMap);
    }

    Set<Map<String, Object>> configObjMap = new HashSet<>();

    for (Config config : m_configurations.values()) {
      Map<String, Object> configMap = new HashMap<>();
      configMap.put(ConfigurationResourceProvider.TYPE, config.getType());
      configMap.put(ConfigurationResourceProvider.TAG, config.getTag());
      configObjMap.add(configMap);
    }

    ConfigGroupEntity configGroupEntity = getConfigGroupEntity();
    ConfigGroupResponse configGroupResponse = new ConfigGroupResponse(
        configGroupEntity.getGroupId(), cluster.getClusterName(),
        configGroupEntity.getGroupName(), configGroupEntity.getTag(),
        configGroupEntity.getDescription(), hostnames, configObjMap);
    return configGroupResponse;
  }
Persist config group config mapping and create configs if not in DB

@param clusterEntity
@throws Exception
ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java