@GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("revert-requests/{id}") @ApiOperation( value = "Returns the Revert Request with the given ID", response = VersionedFlowUpdateRequestEntity.class, notes = "Returns the Revert Request with the given ID. Once a Revert Request has been created by performing a POST to /versions/revert-requests/process-groups/{id}, " + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + "current state of the request, and any failures. " + NON_GUARANTEED_ENDPOINT, authorizations = { @Authorization(value = "Only the user that submitted the request can get it") }) @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 getRevertRequest(@ApiParam("The ID of the Revert Request") @PathParam("id") final String revertRequestId) { return retrieveRequest("revert-requests", revertRequestId); }
if (apiOperation.hidden()) { return null; if (!"".equals(apiOperation.nickname())) { operationId = apiOperation.nickname(); List<SecurityRequirement> securities = new ArrayList<>(); for (Authorization auth : apiOperation.authorizations()) { if (auth.value() != null && !"".equals(auth.value())) { SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); AuthorizationScope[] scopes = auth.scopes(); for (AuthorizationScope scope : scopes) { if (scope.scope() != null && !"".equals(scope.scope())) { final Consumes consumes = ReflectionUtils.getAnnotation(method, Consumes.class); if (consumes != null) { for (String mediaType : ReaderUtils.splitContentValues(consumes.value())) { operation.consumes(mediaType); apiResponses.addAll(Arrays.asList(responseAnnotation.value())); ApiResponses exceptionResponses = ReflectionUtils.getAnnotation(exceptionType, ApiResponses.class); if (exceptionResponses != null) { apiResponses.addAll(Arrays.asList(exceptionResponses.value()));
if (apiOperation.hidden()) { return null; if (!apiOperation.nickname().isEmpty()) { operationId = apiOperation.nickname(); for (Authorization auth : apiOperation.authorizations()) { if (!auth.value().isEmpty()) { SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); for (AuthorizationScope scope : auth.scopes()) { if (!scope.scope().isEmpty()) { security.addScope(scope.scope()); for (String mediaType : consumes.value()) { operation.consumes(mediaType); for (String mediaType : produces.value()) { operation.produces(mediaType);
if (auth.value() != null && !"".equals(auth.value())) { SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); AuthorizationScope[] scopes = auth.scopes(); for (AuthorizationScope scope : scopes) { if (scope.scope() != null && !"".equals(scope.scope())) { consumes = ReaderUtils.splitContentValues(cls.getAnnotation(Consumes.class).value()); produces = ReaderUtils.splitContentValues(cls.getAnnotation(Produces.class).value()); List<ApiResponse> classApiResponses = new ArrayList<>(); if (classResponseAnnotation != null) { classApiResponses.addAll(Arrays.asList(classResponseAnnotation.value())); for (Scheme scheme : parseSchemes(apiOperation.protocols())) { operation.scheme(scheme); if (httpMethod != null) { if (apiOperation != null) { for (String tag : apiOperation.tags()) { if (!"".equals(tag)) { operation.tag(tag); .putAll(BaseReaderUtils.parseExtensions(apiOperation.extensions()));
if (apiOperation.hidden()) { return null; if (!apiOperation.nickname().isEmpty()) { operationId = apiOperation.nickname(); for (Authorization auth : apiOperation.authorizations()) { if (!auth.value().isEmpty()) { SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); for (AuthorizationScope scope : auth.scopes()) { if (!scope.scope().isEmpty()) { security.addScope(scope.scope());
protected List<SecurityRequirement> getSecurityRequirements(Api api) { List<SecurityRequirement> securities = new ArrayList<>(); if(api == null) { return securities; } for (Authorization auth : api.authorizations()) { if (auth.value().isEmpty()) { continue; } SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); for (AuthorizationScope scope : auth.scopes()) { if (!scope.scope().isEmpty()) { security.addScope(scope.scope()); } } securities.add(security); } return securities; }
@Override public boolean apply(Authorization input) { return !Strings.isNullOrEmpty(input.value()); } });
if (apiOperation.hidden()) { return null; if (!"".equals(apiOperation.nickname())) { operationId = apiOperation.nickname(); List<SecurityRequirement> securities = new ArrayList<>(); for (Authorization auth : apiOperation.authorizations()) { if (auth.value() != null && !"".equals(auth.value())) { SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); AuthorizationScope[] scopes = auth.scopes(); for (AuthorizationScope scope : scopes) { if (scope.scope() != null && !"".equals(scope.scope())) { final Consumes consumes = ReflectionUtils.getAnnotation(method, Consumes.class); if (consumes != null) { for (String mediaType : ReaderUtils.splitContentValues(consumes.value())) { operation.consumes(mediaType); apiResponses.addAll(Arrays.asList(responseAnnotation.value())); ApiResponses exceptionResponses = ReflectionUtils.getAnnotation(exceptionType, ApiResponses.class); if (exceptionResponses != null) { apiResponses.addAll(Arrays.asList(exceptionResponses.value()));
if (auth.value() != null && !"".equals(auth.value())) { SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); AuthorizationScope[] scopes = auth.scopes(); for (AuthorizationScope scope : scopes) { if (scope.scope() != null && !"".equals(scope.scope())) { consumes = ReaderUtils.splitContentValues(cls.getAnnotation(Consumes.class).value()); produces = ReaderUtils.splitContentValues(cls.getAnnotation(Produces.class).value()); List<ApiResponse> classApiResponses = new ArrayList<>(); if (classResponseAnnotation != null) { classApiResponses.addAll(Arrays.asList(classResponseAnnotation.value())); for (Scheme scheme : parseSchemes(apiOperation.protocols())) { operation.scheme(scheme); if (httpMethod != null) { if (apiOperation != null) { for (String tag : apiOperation.tags()) { if (!"".equals(tag)) { operation.tag(tag); .putAll(BaseReaderUtils.parseExtensions(apiOperation.extensions()));
private static List<SecurityRequirement> parseAuthorizations(Authorization[] authorizations) { final List<SecurityRequirement> result = new ArrayList<SecurityRequirement>(); for (Authorization auth : authorizations) { if (StringUtils.isNotEmpty(auth.value())) { final SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); for (AuthorizationScope scope : auth.scopes()) { if (StringUtils.isNotEmpty(scope.scope())) { security.addScope(scope.scope()); } } result.add(security); } } return result; }
@GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("update-requests/{id}") @ApiOperation( value = "Returns the Update Request with the given ID", response = VersionedFlowUpdateRequestEntity.class, notes = "Returns the Update Request with the given ID. Once an Update Request has been created by performing a POST to /versions/update-requests/process-groups/{id}, " + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the updated state, such as percent complete, the " + "current state of the request, and any failures. " + NON_GUARANTEED_ENDPOINT, authorizations = { @Authorization(value = "Only the user that submitted the request can get it") }) @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 getUpdateRequest(@ApiParam("The ID of the Update Request") @PathParam("id") final String updateRequestId) { return retrieveRequest("update-requests", updateRequestId); }
if (apiOperation.hidden()) { return null; if (apiOperation.ignoreJsonView()) { jsonViewAnnotation = null; if (!apiOperation.nickname().isEmpty()) { operationId = apiOperation.nickname(); for (Authorization auth : apiOperation.authorizations()) { if (!auth.value().isEmpty()) { SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); for (AuthorizationScope scope : auth.scopes()) { if (!scope.scope().isEmpty()) { security.addScope(scope.scope()); final Consumes consumes = ReflectionUtils.getAnnotation(method, Consumes.class); if (consumes != null) { for (String mediaType : ReaderUtils.splitContentValues(consumes.value())) { operation.consumes(mediaType); apiResponses.addAll(Arrays.asList(responseAnnotation.value())); ApiResponses exceptionResponses = ReflectionUtils.getAnnotation(exceptionType, ApiResponses.class); if (exceptionResponses != null) { apiResponses.addAll(Arrays.asList(exceptionResponses.value()));
if (auth.value() != null && !auth.value().isEmpty()) { SecurityRequirement security = new SecurityRequirement(); security.setName(auth.value()); for (AuthorizationScope scope : auth.scopes()) { if (scope.scope() != null && !scope.scope().isEmpty()) { security.addScope(scope.scope()); consumes = ReaderUtils.splitContentValues(cls.getAnnotation(Consumes.class).value()); produces = ReaderUtils.splitContentValues(cls.getAnnotation(Produces.class).value()); List<ApiResponse> classApiResponses = new ArrayList<ApiResponse>(); if (classResponseAnnotation != null) { classApiResponses.addAll(Arrays.asList(classResponseAnnotation.value())); for (Scheme scheme : parseSchemes(apiOperation.protocols())) { operation.scheme(scheme); if (httpMethod != null) { if (apiOperation != null) { for (String tag : apiOperation.tags()) { if (!"".equals(tag)) { operation.tag(tag); operation.getVendorExtensions().putAll(BaseReaderUtils.parseExtensions(apiOperation.extensions()));
@DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("revert-requests/{id}") @ApiOperation( value = "Deletes the Revert Request with the given ID", response = VersionedFlowUpdateRequestEntity.class, notes = "Deletes the Revert Request with the given ID. After a request is created via a POST to /versions/revert-requests/process-groups/{id}, it is expected " + "that the client will properly clean up the request by DELETE'ing it, once the Revert process has completed. If the request is deleted before the request " + "completes, then the Revert request will finish the step that it is currently performing and then will cancel any subsequent steps. " + NON_GUARANTEED_ENDPOINT, authorizations = { @Authorization(value = "Only the user that submitted the request can remove it") }) @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 deleteRevertRequest( @ApiParam( value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", required = false ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, @ApiParam("The ID of the Revert Request") @PathParam("id") final String revertRequestId) { return deleteRequest("revert-requests", revertRequestId, disconnectedNodeAcknowledged.booleanValue()); }
@DELETE @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("update-requests/{id}") @ApiOperation( value = "Deletes the Update Request with the given ID", response = VersionedFlowUpdateRequestEntity.class, notes = "Deletes the Update Request with the given ID. After a request is created via a POST to /versions/update-requests/process-groups/{id}, it is expected " + "that the client will properly clean up the request by DELETE'ing it, once the Update process has completed. If the request is deleted before the request " + "completes, then the Update request will finish the step that it is currently performing and then will cancel any subsequent steps. " + NON_GUARANTEED_ENDPOINT, authorizations = { @Authorization(value = "Only the user that submitted the request can remove it") }) @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 deleteUpdateRequest( @ApiParam( value = "Acknowledges that this node is disconnected to allow for mutable requests to proceed.", required = false ) @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, @ApiParam("The ID of the Update Request") @PathParam("id") final String updateRequestId) { return deleteRequest("update-requests", updateRequestId, disconnectedNodeAcknowledged.booleanValue()); }
@GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) @Path("client-id") @ApiOperation( value = "Generates a client id.", response = String.class, authorizations = { @Authorization(value = "Read - /flow") } ) @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 = 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 generateClientId() { authorizeFlow(); return generateOkResponse(generateUuid()).build(); }
@PUT @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("input-ports/{portId}/transactions/{transactionId}") @ApiOperation( value = "Extend transaction TTL", response = TransactionResultEntity.class, authorizations = { @Authorization(value = "Write - /data-transfer/input-ports/{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."), @PathParam("portId") String portId, @PathParam("transactionId") String transactionId, @Context HttpServletRequest req, @Context HttpServletResponse res,
@PUT @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("output-ports/{portId}/transactions/{transactionId}") @ApiOperation( value = "Extend transaction TTL", response = TransactionResultEntity.class, authorizations = { @Authorization(value = "Write - /data-transfer/output-ports/{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."), @PathParam("portId") String portId, @PathParam("transactionId") String transactionId, @Context HttpServletRequest req, @Context HttpServletResponse res,
@Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @Path("controller/bulletins") @ApiOperation( value = "Retrieves Controller level bulletins", response = ControllerBulletinsEntity.class, authorizations = { @Authorization(value = "Read - /flow"), @Authorization(value = "Read - /controller - For controller bulletins"), @Authorization(value = "Read - /controller-services/{uuid} - For controller service bulletins"), @Authorization(value = "Read - /reporting-tasks/{uuid} - For reporting task bulletins") @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."),