protected Set<String> getClustersNameFromResources(Set<Resource> resources, String clusterNamePropertyId) {
    Set<String> clusNames = new HashSet<>();
    if (resources != null) {
      Iterator<Resource> itr = resources.iterator();
      while (itr.hasNext()) {
        Resource res = itr.next();
        if (res != null) {
          clusNames.add((String) res.getPropertyValue(clusterNamePropertyId));
        }
      }
    }
    return clusNames;
  }
Retrieves all the cluster names to which the passed-in Resource's belong.

@param resources Set of Resources.
@return Cluster's Name
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java