/** * Removes the specified output 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 output port to remove. * @return A outputPortEntity. */ @DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("{id}") @ApiOperation( value = "Deletes an output port", response = PortEntity.class, authorizations = {@Authorization(value = "Write - /output-ports/{uuid}", 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 removeOutputPort( @Context final 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) final 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) final ClientIdParameter clientId, @ApiParam(value = "The output port id.", required = true) @PathParam("id") final String id) { if (isReplicateRequest()) { return replicate(HttpMethod.DELETE); } final PortEntity requestPortEntity = new PortEntity(); requestPortEntity.setId(id); // handle expects request (usually from the cluster manager) final Revision requestRevision = new Revision(version == null ? null : version.getLong(), clientId.getClientId(), id); return withWriteLock( serviceFacade, requestPortEntity, requestRevision, lookup -> { final Authorizable outputPort = lookup.getOutputPort(id); outputPort.authorize(authorizer, RequestAction.WRITE, NiFiUserUtils.getNiFiUser()); }, () -> serviceFacade.verifyDeleteOutputPort(id), (revision, portEntity) -> { // delete the specified output port final PortEntity entity = serviceFacade.deleteOutputPort(revision, portEntity.getId()); return clusterContext(generateOkResponse(entity)).build(); }); }