/** * Removes the specified input port. * * @param httpServletRequest request * @param version The revision is used to verify the client is working with the latest version of * the flow. * @param clientId Optional client id. If the client id is not specified, a new one will be * generated. This value (whether specified or generated) is included in the response. * @param id The id of the input port to remove. * @return A inputPortEntity. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") // TODO - @PreAuthorize("hasRole('ROLE_DFM')") @ApiOperation( value = "Deletes an input port", response = InputPortEntity.class, authorizations = {@Authorization(value = "Data Flow Manager", type = "ROLE_DFM")}) @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 removeInputPort( @Context HttpServletRequest httpServletRequest, @ApiParam( value = "The revision is used to verify the client is working with the latest version of the flow.", required = false) @QueryParam(VERSION) LongParameter version, @ApiParam( value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", required = false) @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @ApiParam(value = "The input port id.", required = true) @PathParam("id") String id) { // replicate if cluster manager if (properties.isClusterManager()) { return clusterManager .applyRequest( HttpMethod.DELETE, getAbsolutePath(), getRequestParameters(true), getHeaders()) .getResponse(); } // handle expects request (usually from the cluster manager) final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER); if (expects != null) { serviceFacade.verifyDeleteInputPort(id); return generateContinueResponse().build(); } // determine the specified version Long clientVersion = null; if (version != null) { clientVersion = version.getLong(); } // delete the specified input port final ConfigurationSnapshot<Void> controllerResponse = serviceFacade.deleteInputPort(new Revision(clientVersion, clientId.getClientId()), id); // get the updated revision final RevisionDTO revision = new RevisionDTO(); revision.setClientId(clientId.getClientId()); revision.setVersion(controllerResponse.getVersion()); // build the response entity final InputPortEntity entity = new InputPortEntity(); entity.setRevision(revision); return clusterContext(generateOkResponse(entity)).build(); }