mtien-apache commented on a change in pull request #4846:
URL: https://github.com/apache/nifi/pull/4846#discussion_r583767556
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java
##########
@@ -4173,6 +4179,227 @@ private void sanitizeRegistryInfo(final
VersionedProcessGroup versionedProcessGr
}
}
+ /**
+ * Uploads the specified versioned flow file and adds it to a new process
group.
+ *
+ * @param httpServletRequest request
+ * @param in The flow file stream
+ * @return A processGroupEntity
+ * @throws IOException if there is an error during deserialization of the
InputStream
+ */
+ @POST
+ @Consumes(MediaType.MULTIPART_FORM_DATA)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Path("{id}/process-groups/upload")
+ @ApiOperation(
+ value = "Uploads a versioned flow file and creates a process
group",
+ response = ProcessGroupEntity.class,
+ authorizations = {
+ @Authorization(value = "Write - /process-groups/{uuid}")
+ }
+ )
+ @ApiResponses(
+ value = {
+ @ApiResponse(code = 400, message = "NiFi was unable to
complete the request because it was invalid. The request should not be retried
without modification."),
+ @ApiResponse(code = 401, message = "Client could not be
authenticated."),
+ @ApiResponse(code = 403, message = "Client is not
authorized to make this request."),
+ @ApiResponse(code = 404, message = "The specified resource
could not be found."),
+ @ApiResponse(code = 409, message = "The request was valid
but NiFi was not in the appropriate state to process it. Retrying the same
request later may be successful.")
+ }
+ )
+ public Response uploadProcessGroup(
+ @Context final HttpServletRequest httpServletRequest,
+ @ApiParam(
+ value = "The process group id.",
+ required = true
+ )
+ @PathParam("id") final String groupId,
+ @ApiParam(
+ value = "The process group name.",
+ required = true
+ )
+ @FormDataParam("groupName") final String groupName,
+ @ApiParam(
+ value = "The process group X position.",
+ required = true
+ )
+ @FormDataParam("position-x") final Double positionX,
+ @ApiParam(
+ value = "The process group Y position.",
+ required = true
+ )
+ @FormDataParam("position-y") final Double positionY,
+ @ApiParam(
+ value = "The client id.",
+ required = true
+ )
+ @FormDataParam("clientId") final String clientId,
+ @ApiParam(
+ value = "Acknowledges that this node is disconnected to
allow for mutable requests to proceed.",
+ required = false
+ )
+ @FormDataParam(DISCONNECTED_NODE_ACKNOWLEDGED)
@DefaultValue("false") final Boolean disconnectedNodeAcknowledged,
+ @FormDataParam("file") final InputStream in) throws IOException {
+
+ // ensure the group name is specified
+ if (StringUtils.isBlank(groupName)) {
+ throw new IllegalArgumentException("The process group name is
required.");
+ }
+
+ if (StringUtils.isBlank(groupId)) {
+ throw new IllegalArgumentException("The parent process group id
must be the same as specified in the URI.");
Review comment:
Revised the message.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]