ResourceInstance createInstanceResource(String feedName, String instanceID, UriInfo ui) {
    boolean isAttached = ui.getRequestUri().toString().contains("/feeds/");

    Map<Resource.Type,String> mapIds = new HashMap<>();
    mapIds.put(Resource.Type.DRInstance, instanceID);
    if (isAttached) {
      mapIds.put(Resource.Type.DRFeed, feedName);
    }

    return createResource(Resource.Type.DRInstance, mapIds);
  }
Create a service resource instance.



@param feedName  feed
@param instanceID     instance name
@param ui           uri information

@return a instance resource instance
ambari-server/src/main/java/org/apache/ambari/server/api/services/InstanceService.java