public MetadataUpdateEvent getClustersMetadata() throws AmbariException {
    TreeMap<String, MetadataCluster> metadataClusters = new TreeMap<>();

    for (Cluster cl : clusters.getClusters().values()) {
      StackId stackId = cl.getDesiredStackVersion();

      SecurityType securityType = cl.getSecurityType();

      MetadataCluster metadataCluster = new MetadataCluster(securityType, getMetadataServiceLevelParams(cl), true, getMetadataClusterLevelParams(cl, stackId), null);
      metadataClusters.put(Long.toString(cl.getClusterId()), metadataCluster);
    }

    MetadataUpdateEvent metadataUpdateEvent = new MetadataUpdateEvent(metadataClusters,
        getMetadataAmbariLevelParams(), getMetadataAgentConfigs(), UpdateEventType.CREATE);
    return metadataUpdateEvent;
  }
Collects full metadata info about clusters for agent.
@return metadata info about clusters
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java