class ChefJsonGenerator {

  public static Map<String, JsonObject> generateClusterChefJsonsForInstallation(JsonCluster definition,
      ClusterRuntime clusterEntity) throws KaramelException {
    Map<String, JsonObject> chefJsons = new HashMap<>();
    JsonObject root = new JsonObject();
    aggregateIpAddresses(root, definition, clusterEntity);

    // Add global attributes
    for (JsonCookbook cb : definition.getCookbooks()) {
      addCookbookAttributes(cb, root);
    }

    for (GroupRuntime groupEntity : clusterEntity.getGroups()) {
      JsonObject clone = cloneJsonObject(root);
      JsonGroup jsonGroup = UserClusterDataExtractor.findGroup(definition, groupEntity.getName());
      //Adding all attribtues to all chef-jsons
      for (JsonCookbook cb : jsonGroup.getCookbooks()) {
        addCookbookAttributes(cb, clone);
      }
      for (JsonCookbook cb : jsonGroup.getCookbooks()) {
        Map<String, JsonObject> gj = generateRecipesChefJsons(clone, cb, groupEntity);
        chefJsons.putAll(gj);
      }
    }
    return chefJsons;
  }

}