bbende commented on a change in pull request #3677: NIFI-6598 Storing peers 
into managed-state
URL: https://github.com/apache/nifi/pull/3677#discussion_r326764579
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java
 ##########
 @@ -827,6 +829,61 @@ public Response updateRemoteProcessGroupRunStatus(
         );
     }
 
+    /**
+     * Gets the state for a RemoteProcessGroup.
+     *
+     * @param id The id of the RemoteProcessGroup
+     * @return a componentStateEntity
+     * @throws InterruptedException if interrupted
+     */
+    @GET
+    @Consumes(MediaType.WILDCARD)
+    @Produces(MediaType.APPLICATION_JSON)
+    @Path("/{id}/state")
+    @ApiOperation(
+        value = "Gets the state for a RemoteProcessGroup",
+        response = ComponentStateEntity.class,
+        authorizations = {
+            @Authorization(value = "Write - /remote-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 getState(
+        @ApiParam(
+            value = "The processor id.",
+            required = true
+        )
+        @PathParam("id") final String id) throws InterruptedException {
+
+        if (isReplicateRequest()) {
+            return replicate(HttpMethod.GET);
+        }
+
+        // authorize access
+        serviceFacade.authorizeAccess(lookup -> {
+            final Authorizable authorizable = lookup.getRemoteProcessGroup(id);
+            authorizable.authorize(authorizer, RequestAction.WRITE, 
NiFiUserUtils.getNiFiUser());
 
 Review comment:
   Should this be READ since its a GET request?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to