protected Set<Long> getClustersResourceId(Set<Resource> resources, String clusterNamePropertyId) {
    Set<Long> clusterResId = new HashSet<>();
    if (clusterNamePropertyId != null) {
      try {
        AmbariManagementController amc = AmbariServer.getController();
        Set<String> clusterNames = getClustersNameFromResources(resources, clusterNamePropertyId);
        Iterator<String> clusNameItr = clusterNames.iterator();
        while (clusNameItr.hasNext()) {
          clusterResId.add(amc.getClusters().getCluster(clusNameItr.next()).getResourceId());
        }
      } catch (AmbariException e) {
        LOG.error("Cluster Id couldn't be retrieved.");
      } catch (Exception e) {
        LOG.error("Cluster Id couldn't be retrieved");
      }
    }
    if(LOG.isDebugEnabled()) {
      LOG.debug("Retrieved Cluster Ids = {}", clusterResId);
    }
    return clusterResId;
  }
Retrieves all the 'Cluster's Resource Ids' from the passed-in Resources.

@param resources Set of Resources.
@param clusterNamePropertyId ClusterName PropertyId.
@return cluster Id.
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java