public Request createRequest(HttpHeaders headers, RequestBody body, UriInfo uriInfo, Request.Type requestType,
                               ResourceInstance resource) {
    switch (requestType) {
      case GET:
        return createGetRequest(headers, body, uriInfo, resource);
      case PUT:
        return createPutRequest(headers, body, uriInfo, resource);
      case DELETE:
        return createDeleteRequest(headers, body, uriInfo, resource);
      case POST:
        return createPostRequest(headers, body, uriInfo, resource);
      default:
        throw new IllegalArgumentException("Invalid request type: " + requestType);
    }
  }
Create a request instance.

@param headers      http headers
@param uriInfo      uri information
@param requestType  http request type
@param resource     associated resource instance

@return a new Request instance
ambari-server/src/main/java/org/apache/ambari/server/api/services/RequestFactory.java