Github user mcgilman commented on a diff in the pull request: https://github.com/apache/nifi/pull/2051#discussion_r131994112 --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java --- @@ -640,7 +643,128 @@ public Response scheduleComponents( componentsToSchedule.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> getRevision(e.getValue(), e.getKey()))); // update the process group - final ScheduleComponentsEntity entity = serviceFacade.scheduleComponents(id, scheduledState, componentRevisions); + final ScheduleComponentsEntity entity = serviceFacade.scheduleComponents(id, scheduledState, componentRevisions); + return generateOkResponse(entity).build(); + } + ); + } + + + @PUT + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("process-groups/{id}/controller-services") + @ApiOperation(value = "Enable or disable Controller Services in the specified Process Group.", + response = ActivateControllerServicesEntity.class, + authorizations = { + @Authorization(value = "Read - /flow", type = ""), + @Authorization(value = "Write - /{component-type}/{uuid} - For every service being enabled/disabled", type = "") + }) + @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 activateControllerServices( + @Context HttpServletRequest httpServletRequest, + @ApiParam(value = "The process group id.", required = true) + @PathParam("id") String id, + @ApiParam(value = "The request to schedule or unschedule. If the comopnents in the request are not specified, all authorized components will be considered.", required = true) + final ActivateControllerServicesEntity requestEntity) { + + // ensure the same id is being used + if (!id.equals(requestEntity.getId())) { + throw new IllegalArgumentException(String.format("The process group id (%s) in the request body does " + + "not equal the process group id of the requested resource (%s).", requestEntity.getId(), id)); + } + + final ControllerServiceState state; + if (requestEntity.getState() == null) { + throw new IllegalArgumentException("The scheduled state must be specified."); + } else { + try { + state = ControllerServiceState.valueOf(requestEntity.getState()); + } catch (final IllegalArgumentException iae) { + throw new IllegalArgumentException(String.format("The scheduled must be one of [%s].", --- End diff -- Looks like another copy/paste in this error message. Also, appears to be missing 'state' in where the message was copied from.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---