protected Map<String, QueryImpl> ensureSubResources() {
    if (availableSubResources == null) {
      availableSubResources = new HashMap<>();
      Set<SubResourceDefinition> setSubResourceDefs =
          getResourceDefinition().getSubResourceDefinitions();

      ClusterController controller = clusterController;

      for (SubResourceDefinition subResDef : setSubResourceDefs) {
        Resource.Type type = subResDef.getType();
        Map<Resource.Type, String> valueMap = getKeyValueMap();
        QueryImpl resource =  new QueryImpl(valueMap,
            ResourceInstanceFactoryImpl.getResourceDefinition(type, valueMap),
            controller);

        String subResourceName = getSubResourceName(resource.getResourceDefinition(), subResDef);
        availableSubResources.put(subResourceName, resource);
      }
    }
    return availableSubResources;
  }
Get the map of sub-resources.  Lazily create the map if required.
ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java