private IdealState buildIdealState(String dcName, String resourceName,
      List<Map.Entry<String, Set<String>>> partitionsUnderResource) {
    IdealState idealState = new IdealState(resourceName);
    idealState.setStateModelDefRef(stateModelDef);
    info("[{}] Adding partitions for next resource {} in {}. {}.", dcName.toUpperCase(), resourceName, dcName,
        dryRun ? "Actual IdealState is not changed as dry run" : "IdealState is being updated");
    updateIdealStatePartitions(idealState, partitionsUnderResource);
    if (!idealState.isValid()) {
      throw new IllegalStateException("IdealState could not be validated for new resource " + resourceName);
    }
    return idealState;
  }
Build a new IdealState for the given resource name and partition layout
@param dcName The name of the datacenter
@param resourceName The name of the newly created resource
@param partitionsUnderResource The partition layout
@return The new IdealState
ambry-clustermap/src/main/java/com/github/ambry/clustermap/HelixBootstrapUpgradeUtil.java