From 96e9bae348112569c789e72d510ab6b8861962af Mon Sep 17 00:00:00 2001 From: EndzeitBegins <16666115+EndzeitBegins@users.noreply.github.com> Date: Sun, 12 Jan 2025 11:25:48 +0100 Subject: [PATCH] NIFI-14144 Declare status code and content for success in OpenAPI spec --- .../nifi/web/api/AccessPolicyResource.java | 67 +- .../apache/nifi/web/api/AccessResource.java | 33 +- .../nifi/web/api/ConnectionResource.java | 55 +- .../nifi/web/api/ControllerResource.java | 509 +++++------- .../web/api/ControllerServiceResource.java | 207 +++-- .../apache/nifi/web/api/CountersResource.java | 25 +- .../nifi/web/api/DataTransferResource.java | 99 +-- .../nifi/web/api/FlowFileQueueResource.java | 109 ++- .../org/apache/nifi/web/api/FlowResource.java | 737 ++++++++---------- .../apache/nifi/web/api/FunnelResource.java | 43 +- .../nifi/web/api/InputPortResource.java | 55 +- .../apache/nifi/web/api/LabelResource.java | 43 +- .../nifi/web/api/OutputPortResource.java | 55 +- .../web/api/ParameterContextResource.java | 237 +++--- .../web/api/ParameterProviderResource.java | 223 +++--- .../nifi/web/api/ProcessGroupResource.java | 496 +++++------- .../nifi/web/api/ProcessorResource.java | 209 +++-- .../nifi/web/api/ProvenanceEventResource.java | 91 +-- .../nifi/web/api/ProvenanceResource.java | 93 +-- .../web/api/RemoteProcessGroupResource.java | 131 ++-- .../nifi/web/api/ReportingTaskResource.java | 169 ++-- .../apache/nifi/web/api/ResourceResource.java | 17 +- .../nifi/web/api/SiteToSiteResource.java | 43 +- .../apache/nifi/web/api/SnippetResource.java | 51 +- .../web/api/SystemDiagnosticsResource.java | 28 +- .../apache/nifi/web/api/TenantsResource.java | 141 ++-- .../apache/nifi/web/api/VersionsResource.java | 248 +++--- .../web/api/AccessPolicyResource.java | 139 ++-- .../nifi/registry/web/api/AccessResource.java | 105 ++- .../web/api/BucketBundleResource.java | 43 +- .../registry/web/api/BucketFlowResource.java | 234 +++--- .../nifi/registry/web/api/BucketResource.java | 75 +- .../nifi/registry/web/api/BundleResource.java | 195 +++-- .../nifi/registry/web/api/ConfigResource.java | 12 +- .../web/api/ExtensionRepoResource.java | 195 +++-- .../registry/web/api/ExtensionResource.java | 30 +- .../nifi/registry/web/api/FlowResource.java | 91 +-- .../nifi/registry/web/api/ItemResource.java | 29 +- .../nifi/registry/web/api/TenantResource.java | 181 ++--- 39 files changed, 2398 insertions(+), 3145 deletions(-) diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java index 9d468ac646bc..03c1c67abcf6 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java @@ -16,14 +16,11 @@ */ package org.apache.nifi.web.api; -import java.net.URI; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -60,6 +57,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.net.URI; + /** * RESTful endpoint for managing access policies. */ @@ -120,18 +119,16 @@ public AccessPolicyEntity populateRemainingAccessPolicyEntityContent(AccessPolic + "have permissions to that policy, the response will not include the policy and the permissions in the response " + "will be marked accordingly. If the client does not have permissions to the policy of the desired action and resource " + "a 403 response will be returned.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), - security = { - @SecurityRequirement(name = "Read - /policies/{resource}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /policies/{resource}") } ) public Response getAccessPolicyForResource( @@ -187,18 +184,16 @@ public Response getAccessPolicyForResource( @Produces(MediaType.APPLICATION_JSON) @Operation( summary = "Creates an access policy", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), - security = { - @SecurityRequirement(name = "Write - /policies/{resource}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /policies/{resource}") } ) public Response createAccessPolicy( @@ -279,18 +274,16 @@ public Response createAccessPolicy( @Path("{id}") @Operation( summary = "Gets an access policy", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), - security = { - @SecurityRequirement(name = "Read - /policies/{resource}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /policies/{resource}") } ) public Response getAccessPolicy( @@ -335,18 +328,16 @@ public Response getAccessPolicy( @Path("{id}") @Operation( summary = "Updates a access policy", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), - security = { - @SecurityRequirement(name = "Write - /policies/{resource}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /policies/{resource}") } ) public Response updateAccessPolicy( @@ -426,19 +417,17 @@ public Response updateAccessPolicy( @Path("{id}") @Operation( summary = "Deletes an access policy", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), - security = { - @SecurityRequirement(name = "Write - /policies/{resource}"), - @SecurityRequirement(name = "Write - Policy of the parent resource - /policies/{resource}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /policies/{resource}"), + @SecurityRequirement(name = "Write - Policy of the parent resource - /policies/{resource}") } ) public Response removeAccessPolicy( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java index 2e4cfd2a16c7..4dfbacd8319f 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java @@ -16,17 +16,10 @@ */ package org.apache.nifi.web.api; -import java.net.URI; -import java.time.Instant; -import java.util.Collections; -import java.util.Optional; -import java.util.UUID; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -63,6 +56,12 @@ import org.springframework.security.oauth2.server.resource.web.BearerTokenResolver; import org.springframework.stereotype.Controller; +import java.net.URI; +import java.time.Instant; +import java.util.Collections; +import java.util.Optional; +import java.util.UUID; + /** * RESTful endpoint for managing access. */ @@ -97,10 +96,8 @@ public class AccessResource extends ApplicationResource { description = "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. It is stored in the browser as a cookie, but also returned in" + "the response body to be stored/used by third party client scripts.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))) - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), @@ -158,10 +155,8 @@ public Response createAccessToken( @Path("/logout") @Operation( summary = "Performs a logout for other providers that have been issued a JWT.", - description = NON_GUARANTEED_ENDPOINT - ) - @ApiResponses( - value = { + description = NON_GUARANTEED_ENDPOINT, + responses = { @ApiResponse(responseCode = "200", description = "User was logged out successfully."), @ApiResponse(responseCode = "401", description = "Authentication token provided was empty or not in the correct JWT format."), @ApiResponse(responseCode = "500", description = "Client failed to log out."), @@ -204,11 +199,9 @@ public Response logOut(@Context HttpServletRequest httpServletRequest, @Context @Path("/logout/complete") @Operation( summary = "Completes the logout sequence by removing the cached Logout Request and Cookie if they existed and redirects to /nifi/login.", - description = NON_GUARANTEED_ENDPOINT - ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "200", description = "User was logged out successfully."), + description = NON_GUARANTEED_ENDPOINT, + responses = { + @ApiResponse(responseCode = "302", description = "User was logged out successfully."), @ApiResponse(responseCode = "401", description = "Authentication token provided was empty or not in the correct JWT format."), @ApiResponse(responseCode = "500", description = "Client failed to log out."), } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java index cb9c91b32241..1ac3ac29f4e2 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java @@ -16,15 +16,11 @@ */ package org.apache.nifi.web.api; -import java.util.List; -import java.util.Set; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -57,6 +53,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.util.List; +import java.util.Set; + /** * RESTful endpoint for managing a Connection. */ @@ -105,19 +104,17 @@ public ConnectionEntity populateRemainingConnectionEntityContent(ConnectionEntit @Path("/{id}") @Operation( summary = "Gets a connection", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), - security = { - @SecurityRequirement(name = "Read Source - /{component-type}/{uuid}"), - @SecurityRequirement(name = "Read Destination - /{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read Source - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Read Destination - /{component-type}/{uuid}") } ) public Response getConnection( @@ -160,21 +157,19 @@ public Response getConnection( @Path("/{id}") @Operation( summary = "Updates a connection", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), - security = { - @SecurityRequirement(name = "Write Source - /{component-type}/{uuid}"), - @SecurityRequirement(name = "Write Destination - /{component-type}/{uuid}"), - @SecurityRequirement(name = "Write New Destination - /{component-type}/{uuid} - if updating Destination"), - @SecurityRequirement(name = "Write Process Group - /process-groups/{uuid} - if updating Destination") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write Source - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Write Destination - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Write New Destination - /{component-type}/{uuid} - if updating Destination"), + @SecurityRequirement(name = "Write Process Group - /process-groups/{uuid} - if updating Destination") } ) public Response updateConnection( @@ -291,20 +286,18 @@ public Response updateConnection( @Path("/{id}") @Operation( summary = "Deletes a connection", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), - security = { - @SecurityRequirement(name = "Write Source - /{component-type}/{uuid}"), - @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}"), - @SecurityRequirement(name = "Write Destination - /{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConnectionEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write Source - /{component-type}/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write Destination - /{component-type}/{uuid}") } ) public Response deleteConnection( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java index a1309776224c..e0d662caacf0 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerResource.java @@ -21,7 +21,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -175,17 +174,15 @@ private void authorizeController(final RequestAction action) { @Path("config") @Operation( summary = "Retrieves the configuration for this NiFi Controller", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerConfigurationEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerConfigurationEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response getControllerConfig() { @@ -212,17 +209,15 @@ public Response getControllerConfig() { @Path("config") @Operation( summary = "Retrieves the configuration for this NiFi", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerConfigurationEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerConfigurationEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response updateControllerConfig( @@ -275,19 +270,17 @@ public Response updateControllerConfig( @Path("parameter-providers") @Operation( summary = "Creates a new parameter provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller"), - @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @SecurityRequirement(name = "Write - if the Parameter Provider is restricted - /restricted-components") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Parameter Provider is restricted - /restricted-components") } ) public Response createParameterProvider( @@ -377,19 +370,17 @@ public Response createParameterProvider( @Path("reporting-tasks") @Operation( summary = "Creates a new reporting task", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller"), - @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @SecurityRequirement(name = "Write - if the Reporting Task is restricted - /restricted-components") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = ReportingTaskEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Reporting Task is restricted - /restricted-components") } ) public Response createReportingTask( @@ -471,17 +462,15 @@ public Response createReportingTask( @Path("reporting-tasks/import") @Operation( summary = "Imports a reporting task snapshot", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedReportingTaskImportResponseEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedReportingTaskImportResponseEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response importReportingTaskSnapshot( @@ -543,19 +532,17 @@ public Response importReportingTaskSnapshot( @Path("flow-analysis-rules") @Operation( summary = "Creates a new flow analysis rule", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller"), - @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @SecurityRequirement(name = "Write - if the Flow Analysis Rule is restricted - /restricted-components") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Flow Analysis Rule is restricted - /restricted-components") } ) public Response createFlowAnalysisRule( @@ -642,18 +629,16 @@ public Response createFlowAnalysisRule( @Path("flow-analysis-rules/{id}/state/clear-requests") @Operation( summary = "Clears the state for a flow analysis rule", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), - security = { - @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}") } ) public Response clearState( @@ -701,19 +686,17 @@ public Response clearState( @Path("flow-analysis-rules/{id}") @Operation( summary = "Updates a flow analysis rule", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), - security = { - @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}"), - @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") } ) public Response updateFlowAnalysisRule( @@ -793,20 +776,18 @@ public Response updateFlowAnalysisRule( @Path("flow-analysis-rules/{id}") @Operation( summary = "Deletes a flow analysis rule", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), - security = { - @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}"), - @SecurityRequirement(name = "Write - /controller"), - @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}"), + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") } ) public Response removeFlowAnalysisRule( @@ -873,18 +854,16 @@ public Response removeFlowAnalysisRule( @Path("flow-analysis-rules/{id}/run-status") @Operation( summary = "Updates run status of a flow analysis rule", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), - security = { - @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid} or or /operation/flow-analysis-rules/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid} or or /operation/flow-analysis-rules/{uuid}") } ) public Response updateRunStatus( @@ -977,17 +956,15 @@ private FlowAnalysisRuleEntity populateRemainingFlowAnalysisRuleEntityContent(fi @Path("flow-analysis-rules") @Operation( summary = "Gets all flow analysis rules", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRulesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisRulesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getFlowAnalysisRules() { @@ -1022,18 +999,16 @@ public Response getFlowAnalysisRules() { @Path("flow-analysis-rules/{id}") @Operation( summary = "Gets a flow analysis rule", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisRuleEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") } ) public Response getFlowAnalysisRule( @@ -1070,18 +1045,16 @@ public Response getFlowAnalysisRule( @Path("flow-analysis-rules/{id}/descriptors") @Operation( summary = "Gets a flow analysis rule property descriptor", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") } ) public Response getFlowAnalysisRulePropertyDescriptor( @@ -1133,18 +1106,16 @@ public Response getFlowAnalysisRulePropertyDescriptor( @Path("flow-analysis-rules/{id}/state") @Operation( summary = "Gets the state for a flow analysis rule", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), - security = { - @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /flow-analysis-rules/{uuid}") } ) public Response getFlowAnalysisRuleState( @@ -1177,18 +1148,16 @@ public Response getFlowAnalysisRuleState( @Path("flow-analysis-rules/{id}/config/analysis") @Operation( summary = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") } ) public Response analyzeFlowAnalysisRuleConfiguration( @@ -1236,7 +1205,14 @@ public Response analyzeFlowAnalysisRuleConfiguration( @Path("flow-analysis-rules/{id}/config/verification-requests") @Operation( summary = "Performs verification of the Flow Analysis Rule's configuration", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This will initiate the process of verifying a given Flow Analysis Rule configuration. This may be a long-running task. As a result, this endpoint will immediately return " + "a " + "FlowAnalysisRuleConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + @@ -1247,15 +1223,6 @@ public Response analyzeFlowAnalysisRuleConfiguration( @SecurityRequirement(name = "Read - /flow-analysis-rules/{uuid}") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response submitFlowAnalysisRuleConfigVerificationRequest( @Parameter(description = "The flow analysis rules id.", required = true) @PathParam("id") final String flowAnalysisRuleId, @@ -1299,21 +1266,19 @@ public Response submitFlowAnalysisRuleConfigVerificationRequest( @Path("flow-analysis-rules/{id}/config/verification-requests/{requestId}") @Operation( summary = "Returns the Verification Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), - description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " - + "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. ", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can get it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + + "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. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") } ) public Response getFlowAnalysisRuleVerificationRequest( @@ -1342,21 +1307,19 @@ public Response getFlowAnalysisRuleVerificationRequest( @Path("flow-analysis-rules/{id}/config/verification-requests/{requestId}") @Operation( summary = "Deletes the Verification Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), - description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " - + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can remove it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " + + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") } ) public Response deleteFlowAnalysisRuleVerificationRequest( @@ -1471,18 +1434,16 @@ private VerifyConfigRequestEntity createVerifyFlowAnalysisRuleConfigRequestEntit @Path("registry-clients") @Operation( summary = "Gets the listing of available flow registry clients", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowRegistryClientsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getFlowRegistryClients() { @@ -1512,17 +1473,15 @@ public Response getFlowRegistryClients() { @Path("registry-clients") @Operation( summary = "Creates a new flow registry client", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response createFlowRegistryClient( @@ -1601,18 +1560,16 @@ public Response createFlowRegistryClient( @Path("/registry-clients/{id}") @Operation( summary = "Gets a flow registry client", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response getFlowRegistryClient( @@ -1647,18 +1604,16 @@ public Response getFlowRegistryClient( @Path("/registry-clients/{id}") @Operation( summary = "Updates a flow registry client", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response updateFlowRegistryClient( @@ -1738,18 +1693,16 @@ public Response updateFlowRegistryClient( @Path("/registry-clients/{id}") @Operation( summary = "Deletes a flow registry client", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowRegistryClientEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response deleteFlowRegistryClient( @@ -1814,18 +1767,16 @@ public Response deleteFlowRegistryClient( @Path("/registry-clients/{id}/descriptors") @Operation( summary = "Gets a flow registry client property descriptor", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller/registry-clients/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller/registry-clients/{uuid}") } ) public Response getPropertyDescriptor( @@ -1878,17 +1829,15 @@ public Response getPropertyDescriptor( @Operation( summary = "Retrieves the types of flow that this NiFi supports", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientTypesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowRegistryClientTypesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getRegistryClientTypes() { @@ -1944,17 +1893,15 @@ private FlowRegistryClientsEntity populateRemainingRegistryClientEntityContent(f @Path("bulletin") @Operation( summary = "Creates a new bulletin", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BulletinEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = BulletinEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response createBulletin( @@ -2011,19 +1958,17 @@ public Response createBulletin( @Path("controller-services") @Operation( summary = "Creates a new controller service", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller"), - @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), - @SecurityRequirement(name = "Write - if the Controller Service is restricted - /restricted-components") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - if the Controller Service is restricted - /restricted-components") } ) public Response createControllerService( @@ -2117,17 +2062,15 @@ public Response createControllerService( @Operation( summary = "Gets the contents of the cluster", description = "Returns the contents of the cluster including all nodes and their status.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ClusterEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ClusterEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response getCluster() { @@ -2165,18 +2108,16 @@ public Response getCluster() { @Path("cluster/nodes/{id}") @Operation( summary = "Gets a node in the cluster", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NodeEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NodeEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response getNode( @@ -2221,18 +2162,16 @@ public Response getNode( @Path("cluster/nodes/{id}") @Operation( summary = "Updates a node in the cluster", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NodeEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NodeEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response updateNode( @@ -2291,18 +2230,16 @@ public Response updateNode( @Path("cluster/nodes/{id}") @Operation( summary = "Removes a node from the cluster", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NodeEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NodeEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response deleteNode( @@ -2343,18 +2280,16 @@ public Response deleteNode( @Operation( summary = "Gets status history for the node", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentHistoryEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ComponentHistoryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response getNodeStatusHistory() { @@ -2381,17 +2316,15 @@ public Response getNodeStatusHistory() { @Path("history") @Operation( summary = "Purges history", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = HistoryEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = HistoryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response deleteHistory( @@ -2447,17 +2380,15 @@ public Date getEndDate() { @Path("nar-manager/nars/content") @Operation( summary = "Uploads a NAR and requests for it to be installed", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NarSummaryEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NarSummaryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response uploadNar( @@ -2520,17 +2451,15 @@ public Response uploadNar( @Path("/nar-manager/nars") @Operation( summary = "Retrieves summary information for installed NARs", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NarSummariesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NarSummariesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response getNarSummaries() { @@ -2553,17 +2482,15 @@ public Response getNarSummaries() { @Path("/nar-manager/nars/{id}") @Operation( summary = "Retrieves the summary information for the NAR with the given identifier", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NarDetailsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NarDetailsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response getNarSummary( @@ -2590,17 +2517,15 @@ public Response getNarSummary( @Path("/nar-manager/nars/{id}/details") @Operation( summary = "Retrieves the component types available from the installed NARs", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NarDetailsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NarDetailsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response getNarDetails( @@ -2627,17 +2552,15 @@ public Response getNarDetails( @Path("/nar-manager/nars/{id}/content") @Operation( summary = "Retrieves the content of the NAR with the given id", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = byte[].class))), - security = { - @SecurityRequirement(name = "Read - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = byte[].class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller") } ) public Response downloadNar( @@ -2672,18 +2595,16 @@ public Response downloadNar( @Path("/nar-manager/nars/{id}") @Operation( summary = "Deletes an installed NAR", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = NarSummaryEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = NarSummaryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller") } ) public Response deleteNar( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java index 66977cb17f48..63fb0b4f7491 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ControllerServiceResource.java @@ -16,21 +16,11 @@ */ package org.apache.nifi.web.api; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.stream.Collectors; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.ServletContext; @@ -95,6 +85,15 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; +import java.util.stream.Collectors; + /** * RESTful endpoint for managing a Controller Service. */ @@ -176,7 +175,14 @@ public ControllerServiceDTO populateRemainingControllerServiceContent(final Cont @Path("{id}") @Operation( summary = "Gets a controller service", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, security = { @SecurityRequirement(name = "Read - /controller-services/{uuid}") }, @@ -184,15 +190,6 @@ public ControllerServiceDTO populateRemainingControllerServiceContent(final Cont "such, " + "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response getControllerService( @Parameter( description = "The controller service id.", @@ -235,18 +232,16 @@ public Response getControllerService( @Path("{id}/descriptors") @Operation( summary = "Gets a controller service property descriptor", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller-services/{uuid}") } ) public Response getPropertyDescriptor( @@ -304,18 +299,16 @@ public Response getPropertyDescriptor( @Path("{id}/state") @Operation( summary = "Gets the state for a controller service", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid}") } ) public Response getState( @@ -358,18 +351,16 @@ public Response getState( @Path("{id}/state/clear-requests") @Operation( summary = "Clears the state for a controller service", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid}") } ) public Response clearState( @@ -419,18 +410,16 @@ public Response clearState( @Path("{id}/references") @Operation( summary = "Gets a controller service", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceReferencingComponentsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServiceReferencingComponentsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller-services/{uuid}") } ) public Response getControllerServiceReferences( @@ -468,18 +457,16 @@ public Response getControllerServiceReferences( @Path("{id}/references") @Operation( summary = "Updates a controller services references", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceReferencingComponentsEntity.class))), - security = { - @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operate/{component-type}/{uuid} - For each referencing component specified") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServiceReferencingComponentsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operate/{component-type}/{uuid} - For each referencing component specified") } ) public Response updateControllerServiceReferences( @@ -607,19 +594,17 @@ public Response updateControllerServiceReferences( @Path("{id}") @Operation( summary = "Updates a controller service", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller-services/{uuid}"), - @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") } ) public Response updateControllerService( @@ -700,21 +685,19 @@ public Response updateControllerService( @Path("{id}") @Operation( summary = "Deletes a controller service", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller-services/{uuid}"), - @SecurityRequirement(name = "Write - Parent Process Group if scoped by Process Group - /process-groups/{uuid}"), - @SecurityRequirement(name = "Write - Controller if scoped by Controller - /controller"), - @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group if scoped by Process Group - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write - Controller if scoped by Controller - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") } ) public Response removeControllerService( @@ -785,18 +768,16 @@ public Response removeControllerService( @Path("{id}/run-status") @Operation( summary = "Updates run status of a controller service", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), - security = { - @SecurityRequirement(name = "Write - /controller-services/{uuid} or /operation/controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServiceEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /controller-services/{uuid} or /operation/controller-services/{uuid}") } ) public Response updateRunStatus( @@ -858,18 +839,16 @@ public Response updateRunStatus( @Path("/{id}/config/analysis") @Operation( summary = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), - security = { - @SecurityRequirement(name = "Read - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /controller-services/{uuid}") } ) public Response analyzeConfiguration( @@ -921,7 +900,14 @@ public Response analyzeConfiguration( @Path("/{id}/config/verification-requests") @Operation( summary = "Performs verification of the Controller Service's configuration", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This will initiate the process of verifying a given Controller Service configuration. This may be a long-running task. As a result, this endpoint will immediately return " + "a " + "ControllerServiceConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + @@ -932,15 +918,6 @@ public Response analyzeConfiguration( @SecurityRequirement(name = "Read - /controller-services/{uuid}") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response submitConfigVerificationRequest( @Parameter(description = "The controller service id.", required = true) @PathParam("id") final String controllerServiceId, @@ -989,21 +966,19 @@ public Response submitConfigVerificationRequest( @Path("{id}/config/verification-requests/{requestId}") @Operation( summary = "Returns the Verification Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), - description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " - + "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. ", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can get it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + + "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. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") } ) public Response getVerificationRequest( @@ -1031,21 +1006,19 @@ public Response getVerificationRequest( @Path("{id}/config/verification-requests/{requestId}") @Operation( summary = "Deletes the Verification Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), - description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " - + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can remove it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " + + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") } ) public Response deleteVerificationRequest( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/CountersResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/CountersResource.java index 9487dd87c507..ba9ad3dcda15 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/CountersResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/CountersResource.java @@ -21,7 +21,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -85,17 +84,15 @@ private void authorizeCounters(final RequestAction action) { @Operation( summary = "Gets the current counters for this NiFi", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = CountersEntity.class))), - security = { - @SecurityRequirement(name = "Read - /counters") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = CountersEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /counters") } ) public Response getCounters( @@ -172,18 +169,16 @@ public Response getCounters( @Operation( summary = "Updates the specified counter. This will reset the counter value to 0", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = CounterEntity.class))), - security = { - @SecurityRequirement(name = "Write - /counters") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = CounterEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /counters") } ) public Response updateCounter( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java index f8f2fe1feada..6ae67702d182 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/DataTransferResource.java @@ -16,19 +16,11 @@ */ package org.apache.nifi.web.api; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.UnknownHostException; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.ServletContext; @@ -84,6 +76,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetAddress; +import java.net.UnknownHostException; + import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.nifi.remote.protocol.HandshakeProperty.BATCH_COUNT; import static org.apache.nifi.remote.protocol.HandshakeProperty.BATCH_DURATION; @@ -156,19 +155,17 @@ protected void authorizeDataTransfer(final AuthorizableLookup lookup, final Reso @Path("{portType}/{portId}/transactions") @Operation( summary = "Create a transaction to the specified output port or input port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), - security = { - @SecurityRequirement(name = "Write - /data-transfer/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + }, + security = { + @SecurityRequirement(name = "Write - /data-transfer/{component-type}/{uuid}") } ) public Response createPortTransaction( @@ -229,19 +226,17 @@ public Response createPortTransaction( @Path("input-ports/{portId}/transactions/{transactionId}/flow-files") @Operation( summary = "Transfer flow files to the input port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))), - security = { - @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "202", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + }, + security = { + @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") } ) public Response receiveFlowFiles( @@ -379,19 +374,17 @@ private Peer constructPeer(final HttpServletRequest req, final InputStream input @Path("output-ports/{portId}/transactions/{transactionId}") @Operation( summary = "Commit or cancel the specified transaction", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), - security = { - @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + }, + security = { + @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") } ) public Response commitOutputPortTransaction( @@ -488,19 +481,17 @@ public Response commitOutputPortTransaction( @Path("input-ports/{portId}/transactions/{transactionId}") @Operation( summary = "Commit or cancel the specified transaction", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), - security = { - @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + }, + security = { + @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") } ) public Response commitInputPortTransaction( @@ -608,13 +599,8 @@ private Response cancelTransaction(String transactionId, TransactionResultEntity @Path("output-ports/{portId}/transactions/{transactionId}/flow-files") @Operation( summary = "Transfer flow files from the output port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StreamingOutput.class))), - security = { - @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "202", content = @Content(schema = @Schema(implementation = StreamingOutput.class))), @ApiResponse(responseCode = "200", description = "There is no flow file to return."), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @@ -622,6 +608,9 @@ private Response cancelTransaction(String transactionId, TransactionResultEntity @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + }, + security = { + @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") } ) public Response transferFlowFiles( @@ -690,18 +679,16 @@ public Response transferFlowFiles( @Path("input-ports/{portId}/transactions/{transactionId}") @Operation( summary = "Extend transaction TTL", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), - security = { - @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /data-transfer/input-ports/{uuid}") } ) public Response extendInputPortTransactionTTL( @@ -727,19 +714,17 @@ public Response extendInputPortTransactionTTL( @Path("output-ports/{portId}/transactions/{transactionId}") @Operation( summary = "Extend transaction TTL", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), - security = { - @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = TransactionResultEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), @ApiResponse(responseCode = "503", description = "NiFi instance is not ready for serving request, or temporarily overloaded. Retrying the same request later may be successful"), + }, + security = { + @SecurityRequirement(name = "Write - /data-transfer/output-ports/{uuid}") } ) public Response extendOutputPortTransactionTTL( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowFileQueueResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowFileQueueResource.java index f860f7a55b1f..dba164a417fc 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowFileQueueResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowFileQueueResource.java @@ -16,14 +16,11 @@ */ package org.apache.nifi.web.api; -import java.net.URI; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -66,6 +63,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.net.URI; + /** * RESTful endpoint for managing a flowfile queue. */ @@ -124,18 +123,16 @@ public FlowFileSummaryDTO populateRemainingFlowFileContent(final String connecti @Path("{id}/flowfiles/{flowfile-uuid}") @Operation( summary = "Gets a FlowFile from a Connection.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowFileEntity.class))), - security = { - @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowFileEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) public Response getFlowFile( @@ -198,13 +195,8 @@ public Response getFlowFile( @Path("{id}/flowfiles/{flowfile-uuid}/content") @Operation( summary = "Gets the content for a FlowFile in a Connection.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StreamingOutput.class))), - security = { - @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StreamingOutput.class))), @ApiResponse(responseCode = "206", description = "Partial Content with range of bytes requested"), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @@ -212,6 +204,9 @@ public Response getFlowFile( @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it."), @ApiResponse(responseCode = "416", description = "Requested Range Not Satisfiable based on bytes requested") + }, + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) public Response downloadFlowFileContent( @@ -282,19 +277,19 @@ public Response downloadFlowFileContent( @Path("{id}/listing-requests") @Operation( summary = "Lists the contents of the queue in this connection.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ListingRequestEntity.class))), - security = { - @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "202", description = "The request has been accepted. A HTTP response header will contain the URI where the response can be polled."), + responses = { + @ApiResponse( + responseCode = "202", description = "The request has been accepted. A HTTP response header will contain the URI where the response can be polled.", + content = @Content(schema = @Schema(implementation = ListingRequestEntity.class)) + ), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) public Response createFlowFileListing( @@ -349,18 +344,16 @@ public Response createFlowFileListing( @Path("{id}/listing-requests/{listing-request-id}") @Operation( summary = "Gets the current status of a listing request for the specified connection.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ListingRequestEntity.class))), - security = { - @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ListingRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) public Response getListingRequest( @@ -410,18 +403,16 @@ public Response getListingRequest( @Path("{id}/listing-requests/{listing-request-id}") @Operation( summary = "Cancels and/or removes a request to list the contents of this connection.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ListingRequestEntity.class))), - security = { - @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ListingRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read Source Data - /data/{component-type}/{uuid}") } ) public Response deleteListingRequest( @@ -498,19 +489,19 @@ public String getListingRequestId() { @Path("{id}/drop-requests") @Operation( summary = "Creates a request to drop the contents of the queue in this connection.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), - security = { - @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "202", description = "The request has been accepted. A HTTP response header will contain the URI where the response can be polled."), + responses = { + @ApiResponse( + responseCode = "202", description = "The request has been accepted. A HTTP response header will contain the URI where the response can be polled.", + content = @Content(schema = @Schema(implementation = DropRequestEntity.class)) + ), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") } ) public Response createDropRequest( @@ -568,18 +559,16 @@ public Response createDropRequest( @Path("{id}/drop-requests/{drop-request-id}") @Operation( summary = "Gets the current status of a drop request for the specified connection.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), - security = { - @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") } ) public Response getDropRequest( @@ -629,18 +618,16 @@ public Response getDropRequest( @Path("{id}/drop-requests/{drop-request-id}") @Operation( summary = "Cancels and/or removes a request to drop the contents of this connection.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), - security = { - @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DropRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write Source Data - /data/{component-type}/{uuid}") } ) public Response removeDropRequest( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java index 57300f7456f6..0590e4c67540 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java @@ -24,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.ServletContext; @@ -289,17 +288,15 @@ private void authorizeFlow() { @Path("client-id") @Operation( summary = "Generates a client id.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response generateClientId() { @@ -318,17 +315,15 @@ public Response generateClientId() { @Path("config") @Operation( summary = "Retrieves the configuration for this NiFi flow", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowConfigurationEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowConfigurationEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getFlowConfig() { @@ -354,17 +349,15 @@ public Response getFlowConfig() { @Path("content-viewers") @Operation( summary = "Retrieves the registered content viewers", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ContentViewerEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ContentViewerEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getContentViewers(@Context final HttpServletRequest httpServletRequest) { @@ -469,7 +462,14 @@ private CurrentUserEntity readReplicatedCurrentUserEntity(final Response replica @Path("process-groups/{id}") @Operation( summary = "Gets a process group", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupFlowEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessGroupFlowEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, security = { @SecurityRequirement(name = "Read - /flow") }, @@ -477,15 +477,6 @@ private CurrentUserEntity readReplicatedCurrentUserEntity(final Response replica "such, " + "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response getFlow( @Parameter( description = "The process group id." @@ -511,18 +502,16 @@ public Response getFlow( @Path("process-groups/{id}/breadcrumbs") @Operation( summary = "Gets the breadcrumbs for a process group", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowBreadcrumbEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowBreadcrumbEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getBreadcrumbs( @@ -551,18 +540,16 @@ public Response getBreadcrumbs( @Path("metrics/{producer}") @Operation( summary = "Gets all metrics for the flow from a particular node", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StreamingOutput.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StreamingOutput.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getFlowMetrics( @@ -630,7 +617,13 @@ public Response getFlowMetrics( @Path("controller/controller-services") @Operation( summary = "Gets controller services for reporting tasks", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServicesEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServicesEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, security = { @SecurityRequirement(name = "Read - /flow") }, @@ -638,14 +631,6 @@ public Response getFlowMetrics( "such, " + "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response getControllerServicesFromController(@QueryParam("uiOnly") @DefaultValue("false") final boolean uiOnly, @QueryParam("includeReferencingComponents") @DefaultValue("true") @Parameter(description = "Whether or not to include services' referencing components in the response") boolean includeReferences) { @@ -684,7 +669,13 @@ public Response getControllerServicesFromController(@QueryParam("uiOnly") @Defau @Path("process-groups/{id}/controller-services") @Operation( summary = "Gets all controller services", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServicesEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServicesEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, security = { @SecurityRequirement(name = "Read - /flow") }, @@ -692,14 +683,6 @@ public Response getControllerServicesFromController(@QueryParam("uiOnly") @Defau "such, " + "the selected fields may change at any time, even during incremental releases, without warning. As a result, this parameter should not be provided by any client other than the UI." ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response getControllerServicesFromGroup( @Parameter(description = "The process group id.", required = true) @PathParam("id") final String groupId, @@ -753,17 +736,15 @@ public Response getControllerServicesFromGroup( @Path("parameter-providers") @Operation( summary = "Gets all parameter providers", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProvidersEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProvidersEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getParameterProviders() { @@ -802,17 +783,15 @@ public Response getParameterProviders() { @Path("reporting-tasks") @Operation( summary = "Gets all reporting tasks", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTasksEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ReportingTasksEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getReportingTasks() { @@ -845,16 +824,14 @@ public Response getReportingTasks() { @Path("reporting-tasks/snapshot") @Operation( summary = "Get a snapshot of the given reporting tasks and any controller services they use", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedReportingTaskSnapshot.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedReportingTaskSnapshot.class))), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getReportingTaskSnapshot( @@ -884,16 +861,14 @@ public Response getReportingTaskSnapshot( @Path("reporting-tasks/download") @Operation( summary = "Download a snapshot of the given reporting tasks and any controller services they use", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = byte[].class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = byte[].class))), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response downloadReportingTaskSnapshot( @@ -929,19 +904,17 @@ public Response downloadReportingTaskSnapshot( @Path("process-groups/{id}") @Operation( summary = "Schedule or unschedule components in the specified Process Group.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ScheduleComponentsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow"), - @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operation/{component-type}/{uuid} - For every component being scheduled/unscheduled") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ScheduleComponentsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operation/{component-type}/{uuid} - For every component being scheduled/unscheduled") } ) public Response scheduleComponents( @@ -1135,19 +1108,17 @@ public Response scheduleComponents( @Path("process-groups/{id}/controller-services") @Operation( summary = "Enable or disable Controller Services in the specified Process Group.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ActivateControllerServicesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow"), - @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operation/{component-type}/{uuid} - For every service being enabled/disabled") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ActivateControllerServicesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} or /operation/{component-type}/{uuid} - For every service being enabled/disabled") } ) public Response activateControllerServices( @@ -1275,17 +1246,15 @@ public Response activateControllerServices( @Operation( summary = "Performs a search against this NiFi using the specified search term", description = "Only search results from authorized components will be returned.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SearchResultsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = SearchResultsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response searchFlow( @@ -1317,17 +1286,15 @@ public Response searchFlow( @Path("status") @Operation( summary = "Gets the current status of this NiFi", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerStatusEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerStatusEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getControllerStatus() throws InterruptedException { @@ -1359,17 +1326,15 @@ public Response getControllerStatus() throws InterruptedException { @Path("cluster/summary") @Operation( summary = "The cluster summary for this NiFi", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ClusterSummaryEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ClusterSummaryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getClusterSummary() { @@ -1415,21 +1380,19 @@ public Response getClusterSummary() { @Path("controller/bulletins") @Operation( summary = "Retrieves Controller level bulletins", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerBulletinsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow"), - @SecurityRequirement(name = "Read - /controller - For controller bulletins"), - @SecurityRequirement(name = "Read - /controller-services/{uuid} - For controller service bulletins"), - @SecurityRequirement(name = "Read - /reporting-tasks/{uuid} - For reporting task bulletins") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerBulletinsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Read - /controller - For controller bulletins"), + @SecurityRequirement(name = "Read - /controller-services/{uuid} - For controller service bulletins"), + @SecurityRequirement(name = "Read - /reporting-tasks/{uuid} - For reporting task bulletins") } ) public Response getBulletins() { @@ -1455,17 +1418,15 @@ public Response getBulletins() { @Path("banners") @Operation( summary = "Retrieves the banners for this NiFi", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BannerEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = BannerEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getBanners() { @@ -1501,17 +1462,15 @@ public Response getBanners() { @Operation( summary = "Retrieves the types of processors that this NiFi supports", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorTypesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessorTypesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getProcessorTypes( @@ -1556,17 +1515,15 @@ public Response getProcessorTypes( @Operation( summary = "Retrieves the types of controller services that this NiFi supports", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceTypesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServiceTypesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getControllerServiceTypes( @@ -1633,17 +1590,15 @@ public Response getControllerServiceTypes( @Operation( summary = "Retrieves the types of reporting tasks that this NiFi supports", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskTypesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ReportingTaskTypesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getReportingTaskTypes( @@ -1681,17 +1636,15 @@ public Response getReportingTaskTypes( @Operation( summary = "Retrieves the runtime manifest for this NiFi instance.", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RuntimeManifestEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = RuntimeManifestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getRuntimeManifest() throws InterruptedException { @@ -1717,17 +1670,15 @@ public Response getRuntimeManifest() throws InterruptedException { @Operation( summary = "Retrieves the Processor Definition for the specified component type.", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorDefinition.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessorDefinition.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The processor definition for the coordinates could not be located.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getProcessorDefinition( @@ -1773,17 +1724,15 @@ public Response getProcessorDefinition( @Operation( summary = "Retrieves the Controller Service Definition for the specified component type.", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ControllerServiceDefinition.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ControllerServiceDefinition.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The controller service definition for the coordinates could not be located.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getControllerServiceDefinition( @@ -1829,17 +1778,15 @@ public Response getControllerServiceDefinition( @Operation( summary = "Retrieves the Reporting Task Definition for the specified component type.", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ReportingTaskDefinition.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ReportingTaskDefinition.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The reporting task definition for the coordinates could not be located.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getReportingTaskDefinition( @@ -1885,17 +1832,15 @@ public Response getReportingTaskDefinition( @Operation( summary = "Retrieves the Parameter Provider Definition for the specified component type.", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderDefinition.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderDefinition.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The reporting task definition for the coordinates could not be located.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getParameterProviderDefinition( @@ -1941,17 +1886,15 @@ public Response getParameterProviderDefinition( @Operation( summary = "Retrieves the Flow Analysis Rule Definition for the specified component type.", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleDefinition.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisRuleDefinition.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The flow analysis rule definition for the coordinates could not be located.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getFlowAnalysisRuleDefinition( @@ -1997,17 +1940,15 @@ public Response getFlowAnalysisRuleDefinition( @Operation( summary = "Retrieves the additional details for the specified component type.", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AdditionalDetailsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AdditionalDetailsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The additional details for the coordinates could not be located.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getAdditionalDetails( @@ -2061,17 +2002,15 @@ public Response getAdditionalDetails( @Operation( summary = "Retrieves the types of parameter providers that this NiFi supports", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderTypesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderTypesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getParameterProviderTypes( @@ -2115,17 +2054,15 @@ public Response getParameterProviderTypes( @Operation( summary = "Retrieves the types of available Flow Analysis Rules", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisRuleTypesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisRuleTypesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getFlowAnalysisRuleTypes( @@ -2169,17 +2106,15 @@ public Response getFlowAnalysisRuleTypes( @Operation( summary = "Retrieves the types of prioritizers that this NiFi supports", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PrioritizerTypesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PrioritizerTypesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getPrioritizers() throws InterruptedException { @@ -2208,17 +2143,15 @@ public Response getPrioritizers() throws InterruptedException { @Path("about") @Operation( summary = "Retrieves details about this NiFi to put in the About dialog", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AboutEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AboutEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getAboutInfo(@Context final HttpServletRequest httpServletRequest) { @@ -2265,18 +2198,16 @@ public Response getAboutInfo(@Context final HttpServletRequest httpServletReques @Path("registries") @Operation( summary = "Gets the listing of available flow registry clients", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryClientsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowRegistryClientsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getRegistryClients() { @@ -2318,18 +2249,16 @@ private FlowRegistryClientsEntity populateRemainingRegistryClientEntityContent(f @Path("registries/{id}/branches") @Operation( summary = "Gets the branches from the specified registry for the current user", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryBranchesEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowRegistryBranchesEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getBranches( @@ -2356,18 +2285,16 @@ public Response getBranches( @Path("registries/{id}/buckets") @Operation( summary = "Gets the buckets from the specified registry for the current user", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowRegistryBucketsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowRegistryBucketsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getBuckets( @@ -2410,18 +2337,16 @@ private String getBucketName(final FlowRegistryBucketEntity entity) { @Path("registries/{registry-id}/buckets/{bucket-id}/flows") @Operation( summary = "Gets the flows from the specified registry and bucket for the current user", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getFlows( @@ -2469,18 +2394,16 @@ private String getFlowName(final VersionedFlowEntity flowEntity) { @Path("registries/{registry-id}/buckets/{bucket-id}/flows/{flow-id}/details") @Operation( summary = "Gets the details of a flow from the specified registry and bucket for the specified flow for the current user", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getDetails( @@ -2517,18 +2440,16 @@ public Response getDetails( @Path("registries/{registry-id}/branches/{branch-id-a}/buckets/{bucket-id-a}/flows/{flow-id-a}/{version-a}/diff/branches/{branch-id-b}/buckets/{bucket-id-b}/flows/{flow-id-b}/{version-b}") @Operation( summary = "Gets the differences between two versions of the same versioned flow, the basis of the comparison will be the first version", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowComparisonEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowComparisonEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getVersionDifferences( @@ -2611,18 +2532,16 @@ public Response getVersionDifferences( @Path("registries/{registry-id}/buckets/{bucket-id}/flows/{flow-id}/versions") @Operation( summary = "Gets the flow versions from the specified registry and bucket for the specified flow for the current user", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadataSetEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadataSetEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getVersions( @@ -2698,18 +2617,16 @@ private static ComponentDifferenceDTO limitDifferences(final ComponentDifference @Path("bulletin-board") @Operation( summary = "Gets current bulletins", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BulletinBoardEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow"), - @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For component specific bulletins") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = BulletinBoardEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For component specific bulletins") } ) public Response getBulletinBoard( @@ -2795,18 +2712,16 @@ public Response getBulletinBoard( @Path("processors/{id}/status") @Operation( summary = "Gets status for a processor", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorStatusEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessorStatusEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getProcessorStatus( @@ -2866,18 +2781,16 @@ public Response getProcessorStatus( @Path("input-ports/{id}/status") @Operation( summary = "Gets status for an input port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortStatusEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PortStatusEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getInputPortStatus( @@ -2937,18 +2850,16 @@ public Response getInputPortStatus( @Path("output-ports/{id}/status") @Operation( summary = "Gets status for an output port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortStatusEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PortStatusEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getOutputPortStatus( @@ -3008,18 +2919,16 @@ public Response getOutputPortStatus( @Path("remote-process-groups/{id}/status") @Operation( summary = "Gets status for a remote process group", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RemoteProcessGroupStatusEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = RemoteProcessGroupStatusEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getRemoteProcessGroupStatus( @@ -3081,18 +2990,16 @@ public Response getRemoteProcessGroupStatus( summary = "Gets the status for a process group", description = "The status for a process group includes status for all descendent components. When invoked on the root group with " + "recursive set to true, it will return the current status of every component in the flow.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupStatusEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessGroupStatusEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getProcessGroupStatus( @@ -3156,18 +3063,16 @@ public Response getProcessGroupStatus( @Path("connections/{id}/status") @Operation( summary = "Gets status for a connection", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionStatusEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConnectionStatusEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getConnectionStatus( @@ -3227,18 +3132,16 @@ public Response getConnectionStatus( @Path("connections/{id}/statistics") @Operation( summary = "Gets statistics for a connection", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConnectionStatisticsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConnectionStatisticsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getConnectionStatistics( @@ -3302,18 +3205,16 @@ public Response getConnectionStatistics( @Path("processors/{id}/status/history") @Operation( summary = "Gets status history for a processor", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getProcessorStatusHistory( @@ -3348,18 +3249,16 @@ public Response getProcessorStatusHistory( @Path("process-groups/{id}/status/history") @Operation( summary = "Gets status history for a remote process group", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getProcessGroupStatusHistory( @@ -3394,18 +3293,16 @@ public Response getProcessGroupStatusHistory( @Path("remote-process-groups/{id}/status/history") @Operation( summary = "Gets the status history", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getRemoteProcessGroupStatusHistory( @@ -3440,18 +3337,16 @@ public Response getRemoteProcessGroupStatusHistory( @Path("connections/{id}/status/history") @Operation( summary = "Gets the status history for a connection", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = StatusHistoryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getConnectionStatusHistory( @@ -3480,17 +3375,15 @@ public Response getConnectionStatusHistory( @Path("parameter-contexts") @Operation( summary = "Gets all Parameter Contexts", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /parameter-contexts/{id} for each Parameter Context") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{id} for each Parameter Context") } ) public Response getParameterContexts() { @@ -3548,17 +3441,15 @@ public Response getParameterContexts() { @Operation( summary = "Gets configuration history", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = HistoryEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = HistoryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response queryHistory( @@ -3680,18 +3571,16 @@ public Response queryHistory( @Operation( summary = "Gets an action", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ActionEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ActionEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getAction( @@ -3730,19 +3619,17 @@ public Response getAction( @Operation( summary = "Gets configuration history for a component", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentHistoryEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow"), - @SecurityRequirement(name = "Read underlying component - /{component-type}/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ComponentHistoryEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow"), + @SecurityRequirement(name = "Read underlying component - /{component-type}/{uuid}") } ) public Response getComponentHistory( @@ -3820,18 +3707,16 @@ public Response getComponentHistory( @Path("flow-analysis/results/{processGroupId}") @Operation( summary = "Returns flow analysis results produced by the analysis of a given process group", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisResultEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisResultEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getFlowAnalysisResults( @@ -3863,18 +3748,16 @@ public Response getFlowAnalysisResults( @Path("flow-analysis/results") @Operation( summary = "Returns all flow analysis results currently in effect", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowAnalysisResultEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowAnalysisResultEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response getAllFlowAnalysisResults() { @@ -3906,18 +3789,16 @@ public Response getAllFlowAnalysisResults() { @Operation( summary = "Searches the cluster for a node with the specified address", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ClusterSearchResultsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /flow") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ClusterSearchResultsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /flow") } ) public Response searchCluster( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java index 2711cff2e1c8..9288dccb64dd 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FunnelResource.java @@ -16,14 +16,11 @@ */ package org.apache.nifi.web.api; -import java.util.Set; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -53,6 +50,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.util.Set; + /** * RESTful endpoint for managing a Funnel. */ @@ -100,18 +99,16 @@ public FunnelEntity populateRemainingFunnelEntityContent(FunnelEntity funnelEnti @Path("{id}") @Operation( summary = "Gets a funnel", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FunnelEntity.class))), - security = { - @SecurityRequirement(name = "Read - /funnels/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FunnelEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /funnels/{uuid}") } ) public Response getFunnel( @@ -151,18 +148,16 @@ public Response getFunnel( @Path("{id}") @Operation( summary = "Updates a funnel", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FunnelEntity.class))), - security = { - @SecurityRequirement(name = "Write - /funnels/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FunnelEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /funnels/{uuid}") } ) public Response updateFunnel( @@ -242,19 +237,17 @@ public Response updateFunnel( @Path("{id}") @Operation( summary = "Deletes a funnel", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FunnelEntity.class))), - security = { - @SecurityRequirement(name = "Write - /funnels/{uuid}"), - @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FunnelEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /funnels/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) public Response removeFunnel( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java index 5777d0ea5691..d56d77a2e4c4 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/InputPortResource.java @@ -16,14 +16,11 @@ */ package org.apache.nifi.web.api; -import java.util.Set; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -57,6 +54,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.util.Set; + /** * RESTful endpoint for managing an Input Port. */ @@ -104,18 +103,16 @@ public PortEntity populateRemainingInputPortEntityContent(PortEntity inputPortEn @Path("{id}") @Operation( summary = "Gets an input port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), - security = { - @SecurityRequirement(name = "Read - /input-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PortEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /input-ports/{uuid}") } ) public Response getInputPort( @@ -155,18 +152,16 @@ public Response getInputPort( @Path("{id}") @Operation( summary = "Updates an input port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), - security = { - @SecurityRequirement(name = "Write - /input-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PortEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /input-ports/{uuid}") } ) public Response updateInputPort( @@ -245,19 +240,17 @@ public Response updateInputPort( @Path("{id}") @Operation( summary = "Deletes an input port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), - security = { - @SecurityRequirement(name = "Write - /input-ports/{uuid}"), - @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PortEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /input-ports/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) public Response removeInputPort( @@ -325,18 +318,16 @@ public Response removeInputPort( @Path("/{id}/run-status") @Operation( summary = "Updates run status of an input-port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), - security = { - @SecurityRequirement(name = "Write - /input-ports/{uuid} or /operation/input-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /input-ports/{uuid} or /operation/input-ports/{uuid}") } ) public Response updateRunStatus( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java index c8b55d17e027..baa673bd74b5 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/LabelResource.java @@ -16,14 +16,11 @@ */ package org.apache.nifi.web.api; -import java.util.Set; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -53,6 +50,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.util.Set; + /** * RESTful endpoint for managing a Label. */ @@ -100,18 +99,16 @@ public LabelEntity populateRemainingLabelEntityContent(LabelEntity labelEntity) @Path("{id}") @Operation( summary = "Gets a label", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LabelEntity.class))), - security = { - @SecurityRequirement(name = "Read - /labels/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = LabelEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /labels/{uuid}") } ) public Response getLabel( @@ -151,18 +148,16 @@ public Response getLabel( @Path("{id}") @Operation( summary = "Updates a label", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LabelEntity.class))), - security = { - @SecurityRequirement(name = "Write - /labels/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = LabelEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /labels/{uuid}") } ) public Response updateLabel( @@ -241,19 +236,17 @@ public Response updateLabel( @Path("{id}") @Operation( summary = "Deletes a label", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = LabelEntity.class))), - security = { - @SecurityRequirement(name = "Write - /labels/{uuid}"), - @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = LabelEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /labels/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) public Response removeLabel( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java index e4ed247b6f12..703ea13bcc28 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/OutputPortResource.java @@ -16,14 +16,11 @@ */ package org.apache.nifi.web.api; -import java.util.Set; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -57,6 +54,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.util.Set; + /** * RESTful endpoint for managing an Output Port. */ @@ -104,18 +103,16 @@ public PortEntity populateRemainingOutputPortEntityContent(PortEntity outputPort @Path("{id}") @Operation( summary = "Gets an output port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), - security = { - @SecurityRequirement(name = "Read - /output-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PortEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /output-ports/{uuid}") } ) public Response getOutputPort( @@ -155,18 +152,16 @@ public Response getOutputPort( @Path("{id}") @Operation( summary = "Updates an output port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), - security = { - @SecurityRequirement(name = "Write - /output-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PortEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /output-ports/{uuid}") } ) public Response updateOutputPort( @@ -245,19 +240,17 @@ public Response updateOutputPort( @Path("{id}") @Operation( summary = "Deletes an output port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PortEntity.class))), - security = { - @SecurityRequirement(name = "Write - /output-ports/{uuid}"), - @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PortEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /output-ports/{uuid}"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}") } ) public Response removeOutputPort( @@ -326,18 +319,16 @@ public Response removeOutputPort( @Path("/{id}/run-status") @Operation( summary = "Updates run status of an output-port", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), - security = { - @SecurityRequirement(name = "Write - /output-ports/{uuid} or /operation/output-ports/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessorEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /output-ports/{uuid} or /operation/output-ports/{uuid}") } ) public Response updateRunStatus( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java index d1a557506d1f..606fa9109ae8 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterContextResource.java @@ -21,7 +21,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.PostConstruct; @@ -42,8 +41,8 @@ import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.StreamingOutput; import org.apache.commons.lang3.StringUtils; -import org.apache.nifi.asset.AssetComponentManager; import org.apache.nifi.asset.Asset; +import org.apache.nifi.asset.AssetComponentManager; import org.apache.nifi.asset.AssetManager; import org.apache.nifi.authorization.AuthorizableLookup; import org.apache.nifi.authorization.Authorizer; @@ -181,19 +180,17 @@ private void authorizeReadParameterContext(final String parameterContextId) { @Path("{id}") @Operation( summary = "Returns the Parameter Context with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), - description = "Returns the Parameter Context with the given ID.", - security = { - @SecurityRequirement(name = "Read - /parameter-contexts/{id}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Returns the Parameter Context with the given ID.", + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{id}") } ) public Response getParameterContext( @@ -224,19 +221,17 @@ public Response getParameterContext( @Produces(MediaType.APPLICATION_JSON) @Operation( summary = "Create a Parameter Context", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), - security = { - @SecurityRequirement(name = "Write - /parameter-contexts"), - @SecurityRequirement(name = "Read - for every inherited parameter context") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /parameter-contexts"), + @SecurityRequirement(name = "Read - for every inherited parameter context") } ) public Response createParameterContext( @@ -292,7 +287,14 @@ public Response createParameterContext( @Path("{id}") @Operation( summary = "Modifies a Parameter Context", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This endpoint will update a Parameter Context to match the provided entity. However, this request will fail if any component is running and is referencing a Parameter in " + "the Parameter Context. Generally, this endpoint is not called directly. Instead, an update request should be submitted by making a POST to the " + "/parameter-contexts/update-requests endpoint. That endpoint will, in turn, call this endpoint.", @@ -301,15 +303,6 @@ public Response createParameterContext( @SecurityRequirement(name = "Write - /parameter-contexts/{id}") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response updateParameterContext( @PathParam("id") String contextId, @Parameter(description = "The updated Parameter Context", required = true) final ParameterContextEntity requestEntity) { @@ -365,7 +358,14 @@ public Response updateParameterContext( @Path("{contextId}/assets") @Operation( summary = "Creates a new Asset in the given Parameter Context", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AssetEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AssetEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This endpoint will create a new Asset in the given Parameter Context. The Asset will be created with the given name and the contents of the file that is uploaded. " + "The Asset will be created in the given Parameter Context, and will be available for use by any component that references the Parameter Context.", security = { @@ -376,15 +376,6 @@ public Response updateParameterContext( @SecurityRequirement(name = "Read - for every currently inherited parameter context") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response createAsset( @PathParam("contextId") final String contextId, @HeaderParam(FILENAME_HEADER) final String assetName, @@ -477,19 +468,17 @@ public Response createAsset( @Path("{contextId}/assets") @Operation( summary = "Lists the assets that belong to the Parameter Context with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AssetsEntity.class))), - description = "Lists the assets that belong to the Parameter Context with the given ID.", - security = { - @SecurityRequirement(name = "Read - /parameter-contexts/{id}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AssetsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Lists the assets that belong to the Parameter Context with the given ID.", + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{id}") } ) public Response getAssets( @@ -520,18 +509,16 @@ public Response getAssets( @Path("{contextId}/assets/{assetId}") @Operation( summary = "Retrieves the content of the asset with the given id", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = byte[].class))), - security = { - @SecurityRequirement(name = "Read - /parameter-contexts/{id}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = byte[].class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /parameter-contexts/{id}") } ) public Response getAssetContent( @@ -573,7 +560,14 @@ public Response getAssetContent( @Path("{contextId}/assets/{assetId}") @Operation( summary = "Deletes an Asset from the given Parameter Context", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AssetEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AssetEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This endpoint will create a new Asset in the given Parameter Context. The Asset will be created with the given name and the contents of the file that is uploaded. " + "The Asset will be created in the given Parameter Context, and will be available for use by any component that references the Parameter Context.", security = { @@ -584,15 +578,6 @@ public Response getAssetContent( @SecurityRequirement(name = "Read - for every currently inherited parameter context") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response deleteAsset( @QueryParam(DISCONNECTED_NODE_ACKNOWLEDGED) @DefaultValue("false") final Boolean disconnectedNodeAcknowledged, @@ -653,7 +638,14 @@ public Response deleteAsset( @Path("{contextId}/update-requests") @Operation( summary = "Initiate the Update Request of a Parameter Context", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This will initiate the process of updating a Parameter Context. Changing the value of a Parameter may require that one or more components be stopped and " + "restarted, so this action may take significantly more time than many other REST API actions. As a result, this endpoint will immediately return a " + "ParameterContextUpdateRequestEntity, " + @@ -669,15 +661,6 @@ public Response deleteAsset( @SecurityRequirement(name = "Read - for any new inherited parameter context") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response submitParameterContextUpdate( @PathParam("contextId") final String contextId, @Parameter(description = "The updated version of the parameter context.", required = true) final ParameterContextEntity requestEntity) { @@ -863,21 +846,19 @@ private boolean isLegalParameterName(final String parameterName) { @Path("{contextId}/update-requests/{requestId}") @Operation( summary = "Returns the Update Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), - description = "Returns the Update Request with the given ID. Once an Update Request has been created by performing a POST to /nifi-api/parameter-contexts, " - + "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. ", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can get it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Returns the Update Request with the given ID. Once an Update Request has been created by performing a POST to /nifi-api/parameter-contexts, " + + "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. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") } ) public Response getParameterContextUpdate( @@ -898,21 +879,19 @@ public Response getParameterContextUpdate( @Path("{contextId}/update-requests/{requestId}") @Operation( summary = "Deletes the Update Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), - description = "Deletes the Update Request with the given ID. After a request is created via a POST to /nifi-api/parameter-contexts/update-requests, 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.", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can remove it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextUpdateRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Deletes the Update Request with the given ID. After a request is created via a POST to /nifi-api/parameter-contexts/update-requests, 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.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") } ) public Response deleteUpdateRequest( @@ -935,7 +914,14 @@ public Response deleteUpdateRequest( @Path("{id}") @Operation( summary = "Deletes the Parameter Context with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "Deletes the Parameter Context with the given ID.", security = { @SecurityRequirement(name = "Read - /parameter-contexts/{uuid}"), @@ -944,15 +930,6 @@ public Response deleteUpdateRequest( @SecurityRequirement(name = "Write - /process-groups/{uuid}, for any Process Group that is currently bound to the Parameter Context") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response deleteParameterContext( @Parameter( description = "The version is used to verify the client is working with the latest version of the flow." @@ -1014,7 +991,14 @@ public Response deleteParameterContext( @Path("{contextId}/validation-requests") @Operation( summary = "Initiate a Validation Request to determine how the validity of components will change if a Parameter Context were to be updated", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This will initiate the process of validating all components whose Process Group is bound to the specified Parameter Context. Performing validation against " + "an arbitrary number of components may be expect and take significantly more time than many other REST API actions. As a result, this endpoint will immediately return " + "a ParameterContextValidationRequestEntity, " + @@ -1025,15 +1009,6 @@ public Response deleteParameterContext( @SecurityRequirement(name = "Read - /parameter-contexts/{parameterContextId}") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response submitValidationRequest( @PathParam("contextId") final String contextId, @Parameter(description = "The validation request", required = true) final ParameterContextValidationRequestEntity requestEntity) { @@ -1096,21 +1071,19 @@ private void authorizeReferencingComponents(final String parameterContextId, fin @Path("{contextId}/validation-requests/{id}") @Operation( summary = "Returns the Validation Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), - description = "Returns the Validation Request with the given ID. Once a Validation Request has been created by performing a POST to /nifi-api/validation-contexts, " - + "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. ", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can get it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Returns the Validation Request with the given ID. Once a Validation Request has been created by performing a POST to /nifi-api/validation-contexts, " + + "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. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") } ) public Response getValidationRequest( @@ -1134,21 +1107,19 @@ public Response getValidationRequest( @Path("{contextId}/validation-requests/{id}") @Operation( summary = "Deletes the Validation Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), - description = "Deletes the Validation Request with the given ID. After a request is created via a POST to /nifi-api/validation-contexts, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the validation process has completed. If the request is deleted before the request " - + "completes, then the Validation request will finish the step that it is currently performing and then will cancel any subsequent steps.", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can remove it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterContextValidationRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Deletes the Validation Request with the given ID. After a request is created via a POST to /nifi-api/validation-contexts, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the validation process has completed. If the request is deleted before the request " + + "completes, then the Validation request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") } ) public Response deleteValidationRequest( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterProviderResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterProviderResource.java index 8447cbd9596f..5e91fef6564d 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterProviderResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ParameterProviderResource.java @@ -22,7 +22,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.PostConstruct; @@ -236,18 +235,16 @@ public ParameterProviderDTO populateRemainingParameterProviderContent(final Para @Path("{id}") @Operation( summary = "Gets a parameter provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), - security = { - @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) public Response getParameterProvider( @@ -286,18 +283,16 @@ public Response getParameterProvider( @Path("{id}/references") @Operation( summary = "Gets all references to a parameter provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderReferencingComponentsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderReferencingComponentsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) public Response getParameterProviderReferences( @@ -336,18 +331,16 @@ public Response getParameterProviderReferences( @Path("{id}/descriptors") @Operation( summary = "Gets a parameter provider property descriptor", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), - security = { - @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PropertyDescriptorEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) public Response getPropertyDescriptor( @@ -400,18 +393,16 @@ public Response getPropertyDescriptor( @Path("{id}/state") @Operation( summary = "Gets the state for a parameter provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), - security = { - @SecurityRequirement(name = "Write - /parameter-providers/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid}") } ) public Response getState( @@ -454,18 +445,16 @@ public Response getState( @Path("{id}/state/clear-requests") @Operation( summary = "Clears the state for a parameter provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), - security = { - @SecurityRequirement(name = "Write - /parameter-providers/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ComponentStateEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid}") } ) public Response clearState( @@ -516,19 +505,17 @@ public Response clearState( @Path("{id}") @Operation( summary = "Updates a parameter provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), - security = { - @SecurityRequirement(name = "Write - /parameter-providers/{uuid}"), - @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid}"), + @SecurityRequirement(name = "Read - any referenced Controller Services if this request changes the reference - /controller-services/{uuid}") } ) public Response updateParameterProvider( @@ -607,20 +594,18 @@ public Response updateParameterProvider( @Path("{id}") @Operation( summary = "Deletes a parameter provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), - security = { - @SecurityRequirement(name = "Write - /parameter-providers/{uuid}"), - @SecurityRequirement(name = "Write - /controller"), - @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid}"), + @SecurityRequirement(name = "Write - /controller"), + @SecurityRequirement(name = "Read - any referenced Controller Services - /controller-services/{uuid}") } ) public Response removeParameterProvider( @@ -691,18 +676,16 @@ public Response removeParameterProvider( @Path("{id}/parameters/fetch-requests") @Operation( summary = "Fetches and temporarily caches the parameters for a provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), - security = { - @SecurityRequirement(name = "Write - /parameter-providers/{uuid} or or /operation/parameter-providers/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /parameter-providers/{uuid} or or /operation/parameter-providers/{uuid}") } ) public Response fetchParameters( @@ -828,7 +811,14 @@ private void authorizeReferencingComponents(final String parameterContextId, fin @Path("{providerId}/apply-parameters-requests") @Operation( summary = "Initiate a request to apply the fetched parameters of a Parameter Provider", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This will initiate the process of applying fetched parameters to all referencing Parameter Contexts. Changing the value of a Parameter may require that one or more " + "components be stopped and restarted, so this action may take significantly more time than many other REST API actions. As a result, this endpoint will immediately return a " + "ParameterProviderApplyParametersRequestEntity, and the process of updating the necessary components will occur asynchronously in the background. The client may then " + @@ -841,15 +831,6 @@ private void authorizeReferencingComponents(final String parameterContextId, fin @SecurityRequirement(name = "Write - for every component that is affected by the update") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response submitApplyParameters( @PathParam("providerId") final String parameterProviderId, @Parameter(description = "The apply parameters request.", required = true) final ParameterProviderParameterApplicationEntity requestEntity) { @@ -1021,21 +1002,19 @@ private Set getParameterStatus(final ParameterProviderEntity @Path("{providerId}/apply-parameters-requests/{requestId}") @Operation( summary = "Returns the Apply Parameters Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), - description = "Returns the Apply Parameters Request with the given ID. Once an Apply Parameters Request has been created by performing a POST to /nifi-api/parameter-providers, " - + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the state, such as percent complete, the " - + "current state of the request, and any failures. ", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can get it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Returns the Apply Parameters Request with the given ID. Once an Apply Parameters Request has been created by performing a POST to /nifi-api/parameter-providers, " + + "that request can subsequently be retrieved via this endpoint, and the request that is fetched will contain the state, such as percent complete, the " + + "current state of the request, and any failures. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") } ) public Response getParameterProviderApplyParametersRequest( @@ -1053,21 +1032,19 @@ public Response getParameterProviderApplyParametersRequest( @Path("{providerId}/apply-parameters-requests/{requestId}") @Operation( summary = "Deletes the Apply Parameters Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), - description = "Deletes the Apply Parameters Request with the given ID. After a request is created via a POST to /nifi-api/parameter-providers/apply-parameters-requests, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Apply process has completed. If the request is deleted before the request " - + "completes, then the Apply Parameters Request will finish the step that it is currently performing and then will cancel any subsequent steps.", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can remove it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ParameterProviderApplyParametersRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Deletes the Apply Parameters Request with the given ID. After a request is created via a POST to /nifi-api/parameter-providers/apply-parameters-requests, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Apply process has completed. If the request is deleted before the request " + + "completes, then the Apply Parameters Request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") } ) public Response deleteApplyParametersRequest( @@ -1088,18 +1065,16 @@ public Response deleteApplyParametersRequest( @Path("/{id}/config/analysis") @Operation( summary = "Performs analysis of the component's configuration, providing information about which attributes are referenced.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), - security = { - @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConfigurationAnalysisEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) public Response analyzeConfiguration( @@ -1150,7 +1125,14 @@ public Response analyzeConfiguration( @Path("/{id}/config/verification-requests") @Operation( summary = "Performs verification of the Parameter Provider's configuration", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), + @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), + @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, description = "This will initiate the process of verifying a given Parameter Provider configuration. This may be a long-running task. As a result, this endpoint will immediately return " + "a " + "ParameterProviderConfigVerificationRequestEntity, and the process of performing the verification will occur asynchronously in the background. " + @@ -1161,15 +1143,6 @@ public Response analyzeConfiguration( @SecurityRequirement(name = "Read - /parameter-providers/{uuid}") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), - @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), - @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") - } - ) public Response submitConfigVerificationRequest( @Parameter(description = "The parameter provider id.", required = true) @PathParam("id") final String parameterProviderId, @Parameter(description = "The parameter provider configuration verification request.", required = true) final VerifyConfigRequestEntity parameterProviderConfigRequest) { @@ -1217,21 +1190,19 @@ public Response submitConfigVerificationRequest( @Path("{id}/config/verification-requests/{requestId}") @Operation( summary = "Returns the Verification Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), - description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " - + "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. ", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can get it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Returns the Verification Request with the given ID. Once an Verification Request has been created, " + + "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. ", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can get it") } ) public Response getVerificationRequest( @@ -1258,21 +1229,19 @@ public Response getVerificationRequest( @Path("{id}/config/verification-requests/{requestId}") @Operation( summary = "Deletes the Verification Request with the given ID", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), - description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " - + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " - + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", - security = { - @SecurityRequirement(name = "Only the user that submitted the request can remove it") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VerifyConfigRequestEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + description = "Deletes the Verification Request with the given ID. After a request is created, it is expected " + + "that the client will properly clean up the request by DELETE'ing it, once the Verification process has completed. If the request is deleted before the request " + + "completes, then the Verification request will finish the step that it is currently performing and then will cancel any subsequent steps.", + security = { + @SecurityRequirement(name = "Only the user that submitted the request can remove it") } ) public Response deleteVerificationRequest( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java index 19fde6db5be5..fc22bbdbff12 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java @@ -20,26 +20,11 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationIntrospector; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.stream.Collectors; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -115,7 +100,6 @@ import org.apache.nifi.web.api.entity.ControllerServiceEntity; import org.apache.nifi.web.api.entity.CopyRequestEntity; import org.apache.nifi.web.api.entity.CopyResponseEntity; -import org.apache.nifi.web.api.entity.PasteRequestEntity; import org.apache.nifi.web.api.entity.CopySnippetRequestEntity; import org.apache.nifi.web.api.entity.DropRequestEntity; import org.apache.nifi.web.api.entity.Entity; @@ -128,6 +112,7 @@ import org.apache.nifi.web.api.entity.LabelsEntity; import org.apache.nifi.web.api.entity.OutputPortsEntity; import org.apache.nifi.web.api.entity.ParameterContextReferenceEntity; +import org.apache.nifi.web.api.entity.PasteRequestEntity; import org.apache.nifi.web.api.entity.PasteResponseEntity; import org.apache.nifi.web.api.entity.PortEntity; import org.apache.nifi.web.api.entity.ProcessGroupEntity; @@ -149,6 +134,19 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; +import java.util.stream.Collectors; + /** * RESTful endpoint for managing a Group. */ @@ -241,18 +239,16 @@ private FlowDTO populateRemainingSnippetContent(FlowDTO flow) { @Path("{id}") @Operation( summary = "Gets a process group", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), - security = { - @SecurityRequirement(name = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") } ) public Response getProcessGroup( @@ -292,18 +288,16 @@ public Response getProcessGroup( @Path("{id}/download") @Operation( summary = "Gets a process group for download", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = String.class))), - security = { - @SecurityRequirement(name = "Read - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}") } ) public Response exportProcessGroup( @@ -349,18 +343,16 @@ public Response exportProcessGroup( @Path("{id}/copy") @Operation( summary = "Generates a copy response for the given copy request", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = CopyResponseEntity.class))), - security = { - @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For all encapsulated components") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = CopyResponseEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For all encapsulated components") } ) public Response copy( @@ -431,19 +423,17 @@ public Response copy( @Path("{id}/local-modifications") @Operation( summary = "Gets a list of local modifications to the Process Group since it was last synchronized with the Flow Registry", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = FlowComparisonEntity.class))), - security = { - @SecurityRequirement(name = "Read - /process-groups/{uuid}"), - @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For all encapsulated components") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = FlowComparisonEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /process-groups/{uuid}"), + @SecurityRequirement(name = "Read - /{component-type}/{uuid} - For all encapsulated components") } ) public Response getLocalModifications( @@ -473,18 +463,16 @@ public Response getLocalModifications( @Path("{id}") @Operation( summary = "Updates a process group", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), - security = { - @SecurityRequirement(name = "Write - /process-groups/{uuid}") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ProcessGroupEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /process-groups/{uuid}") } ) public Response updateProcessGroup( @@ -686,20 +674,20 @@ protected T getResponseEntity(final NodeResponse nodeResponse, final Class getHttpHeaders(@Context HttpServletRequest req) { @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Operation( summary = "Returns the available Peers and its status of this NiFi", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = PeersEntity.class))), - security = { - @SecurityRequirement(name = "Read - /site-to-site") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PeersEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /site-to-site") } ) public Response getPeers(@Context HttpServletRequest req) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java index 942c8230bd48..b644af83f5b6 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SnippetResource.java @@ -16,17 +16,11 @@ */ package org.apache.nifi.web.api; -import java.net.URI; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -60,6 +54,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.net.URI; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; + /** * RESTful endpoint for querying dataflow snippets. */ @@ -137,18 +136,16 @@ private void authorizeSnippetRequest(final SnippetDTO snippetRequest, final Auth @Produces(MediaType.APPLICATION_JSON) @Operation( summary = "Creates a snippet. The snippet will be automatically discarded if not used in a subsequent request after 1 minute.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SnippetEntity.class))), - security = { - @SecurityRequirement(name = "Read or Write - /{component-type}/{uuid} - For every component (all Read or all Write) in the Snippet and their descendant components") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = SnippetEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read or Write - /{component-type}/{uuid} - For every component (all Read or all Write) in the Snippet and their descendant components") } ) public Response createSnippet( @@ -221,19 +218,17 @@ public Response createSnippet( @Path("{id}") @Operation( summary = "Move's the components in this Snippet into a new Process Group and discards the snippet", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SnippetEntity.class))), - security = { - @SecurityRequirement(name = "Write Process Group - /process-groups/{uuid}"), - @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For each component in the Snippet and their descendant components") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = SnippetEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write Process Group - /process-groups/{uuid}"), + @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For each component in the Snippet and their descendant components") } ) public Response updateSnippet( @@ -312,19 +307,17 @@ public Response updateSnippet( @Path("{id}") @Operation( summary = "Deletes the components in a snippet and discards the snippet", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SnippetEntity.class))), - security = { - @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For each component in the Snippet and their descendant components"), - @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}"), - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = SnippetEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /{component-type}/{uuid} - For each component in the Snippet and their descendant components"), + @SecurityRequirement(name = "Write - Parent Process Group - /process-groups/{uuid}"), } ) public Response deleteSnippet( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java index 109d94078617..11becd29fccb 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SystemDiagnosticsResource.java @@ -16,14 +16,11 @@ */ package org.apache.nifi.web.api; -import java.util.Collection; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -50,6 +47,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.util.Collection; + /** * RESTful endpoint for retrieving system diagnostics. */ @@ -79,16 +78,15 @@ private void authorizeSystem() { @Produces(MediaType.APPLICATION_JSON) @Operation( summary = "Gets the diagnostics for the system NiFi is running on", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = SystemDiagnosticsEntity.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = SystemDiagnosticsEntity.class))), + @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), + @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), + }, security = { @SecurityRequirement(name = "Read - /system") } ) - @ApiResponses( - value = { - @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), - @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), } - ) public Response getSystemDiagnostics( @Parameter( description = "Whether or not to include the breakdown per node. Optional, defaults to false" @@ -159,18 +157,16 @@ public Response getSystemDiagnostics( @Operation( summary = "Retrieve available JMX metrics", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = JmxMetricsResultsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /system") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = JmxMetricsResultsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /system") } ) public Response getJmxMetrics( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java index ad848ff891b8..d54184180b71 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java @@ -16,16 +16,11 @@ */ package org.apache.nifi.web.api; -import java.net.URI; -import java.util.Date; -import java.util.Set; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -67,6 +62,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import java.net.URI; +import java.util.Date; +import java.util.Set; + @Controller @Path("tenants") @Tag(name = "Tenants") @@ -128,18 +127,16 @@ public UserEntity populateRemainingUserEntityContent(UserEntity userEntity) { @Operation( summary = "Creates a user", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserEntity.class))), - security = { - @SecurityRequirement(name = "Write - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = UserEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /tenants") } ) public Response createUser( @@ -214,18 +211,16 @@ public Response createUser( @Operation( summary = "Gets a user", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserEntity.class))), - security = { - @SecurityRequirement(name = "Read - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /tenants") } ) public Response getUser( @@ -269,18 +264,16 @@ public Response getUser( @Operation( summary = "Gets all users", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UsersEntity.class))), - security = { - @SecurityRequirement(name = "Read - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UsersEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /tenants") } ) public Response getUsers() { @@ -326,18 +319,16 @@ public Response getUsers() { @Operation( summary = "Updates a user", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserEntity.class))), - security = { - @SecurityRequirement(name = "Write - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /tenants") } ) public Response updateUser( @@ -416,18 +407,16 @@ public Response updateUser( @Operation( summary = "Deletes a user", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserEntity.class))), - security = { - @SecurityRequirement(name = "Write - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /tenants") } ) public Response removeUser( @@ -519,18 +508,16 @@ public UserGroupEntity populateRemainingUserGroupEntityContent(UserGroupEntity u @Operation( summary = "Creates a user group", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), - security = { - @SecurityRequirement(name = "Write - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /tenants") } ) public Response createUserGroup( @@ -605,18 +592,16 @@ public Response createUserGroup( @Operation( summary = "Gets a user group", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), - security = { - @SecurityRequirement(name = "Read - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /tenants") } ) public Response getUserGroup( @@ -660,18 +645,16 @@ public Response getUserGroup( @Operation( summary = "Gets all user groups", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserGroupsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /tenants") } ) public Response getUserGroups() { @@ -716,18 +699,16 @@ public Response getUserGroups() { @Operation( summary = "Updates a user group", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), - security = { - @SecurityRequirement(name = "Write - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /tenants") } ) public Response updateUserGroup( @@ -806,18 +787,16 @@ public Response updateUserGroup( @Operation( summary = "Deletes a user group", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), - security = { - @SecurityRequirement(name = "Write - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserGroupEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Write - /tenants") } ) public Response removeUserGroup( @@ -889,18 +868,16 @@ public Response removeUserGroup( @Operation( summary = "Searches for a tenant with the specified identity", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = TenantsEntity.class))), - security = { - @SecurityRequirement(name = "Read - /tenants") - } - ) - @ApiResponses( - value = { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = TenantsEntity.class))), @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(responseCode = "401", description = "Client could not be authenticated."), @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."), @ApiResponse(responseCode = "404", description = "The specified resource could not be found."), @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.") + }, + security = { + @SecurityRequirement(name = "Read - /tenants") } ) public Response searchTenants( diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java index fa11424ac092..ea22448180f1 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java @@ -17,20 +17,11 @@ package org.apache.nifi.web.api; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -87,6 +78,14 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; + @Controller @Path("/versions") @Tag(name = "Versions") @@ -108,19 +107,17 @@ public class VersionsResource extends FlowUpdateResource accessPolicies = serviceFacade.getAccessPolicies(); if (accessPolicies == null) { @@ -159,7 +153,13 @@ public Response getAccessPolicies() { @Path("{id}") @Operation( summary = "Get access policy", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicy.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -168,14 +168,6 @@ public Response getAccessPolicies() { ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getAccessPolicy( @Parameter(description = "The access policy id.", required = true) @PathParam("id") final String identifier) { @@ -187,7 +179,7 @@ public Response getAccessPolicy( /** * Retrieve a specified access policy for a given (action, resource) pair. * - * @param action the action, i.e. "read", "write" + * @param action the action, i.e. "read", "write" * @param rawResource the name of the resource as a raw string * @return An access policy. */ @@ -198,7 +190,14 @@ public Response getAccessPolicy( @Operation( summary = "Get access policy for resource", description = "Gets an access policy for the specified action and resource", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicy.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -207,14 +206,6 @@ public Response getAccessPolicy( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response getAccessPolicyForResource( @Parameter(description = "The request action.", required = true) @PathParam("action") final String action, @@ -233,8 +224,8 @@ public Response getAccessPolicyForResource( /** * Update an access policy. * - * @param httpServletRequest request - * @param identifier The id of the access policy to update. + * @param httpServletRequest request + * @param identifier The id of the access policy to update. * @param requestAccessPolicy An access policy. * @return the updated access policy. */ @@ -244,7 +235,14 @@ public Response getAccessPolicyForResource( @Path("{id}") @Operation( summary = "Update access policy", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicy.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") + }, extensions = { @Extension( name = "access-policy", properties = { @@ -253,15 +251,6 @@ public Response getAccessPolicyForResource( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") - } - ) public Response updateAccessPolicy( @Context final HttpServletRequest httpServletRequest, @Parameter(description = "The access policy id.", required = true) @@ -285,7 +274,7 @@ public Response updateAccessPolicy( * Remove a specified access policy. * * @param httpServletRequest request - * @param identifier The id of the access policy to remove. + * @param identifier The id of the access policy to remove. * @return The deleted access policy */ @DELETE @@ -294,7 +283,13 @@ public Response updateAccessPolicy( @Path("{id}") @Operation( summary = "Delete access policy", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicy.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicy.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") + }, extensions = { @Extension( name = "access-policy", properties = { @@ -303,14 +298,6 @@ public Response updateAccessPolicy( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might not be configured to use a ConfigurableAccessPolicyProvider.") - } - ) public Response removeAccessPolicy( @Context final HttpServletRequest httpServletRequest, @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) @@ -338,11 +325,11 @@ public Response removeAccessPolicy( @Operation( summary = "Get available resources", description = "Gets the available resources that support access/authorization policies", - responses = @ApiResponse( - content = @Content( - array = @ArraySchema(schema = @Schema(implementation = Resource.class)) - ) - ), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Resource.class)))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -351,12 +338,6 @@ public Response removeAccessPolicy( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403) - } - ) public Response getResources() { final List resources = serviceFacade.getResources(); return generateOkResponse(resources).build(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java index ba1bb21d5499..9f612cfe786b 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java @@ -26,23 +26,10 @@ import com.nimbusds.openid.connect.sdk.AuthenticationResponseParser; import com.nimbusds.openid.connect.sdk.AuthenticationSuccessResponse; import io.jsonwebtoken.JwtException; - -import java.io.IOException; -import java.net.URI; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; -import javax.net.ssl.SSLContext; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; @@ -94,6 +81,17 @@ import org.springframework.lang.Nullable; import org.springframework.stereotype.Component; +import javax.net.ssl.SSLContext; +import java.io.IOException; +import java.net.URI; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + @Component @Path("/access") @Tag(name = "Access") @@ -147,11 +145,10 @@ public AccessResource( @Operation( summary = "Get access status", description = "Returns the current client's authenticated identity and permissions to top-level resources", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = CurrentUser.class))) - ) - @ApiResponses( - { - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might be running unsecured.")} + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = CurrentUser.class))), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might be running unsecured.") + } ) public Response getAccessStatus(@Context HttpServletRequest httpServletRequest) { @@ -183,14 +180,14 @@ public Response getAccessStatus(@Context HttpServletRequest httpServletRequest) description = "Creates a token for accessing the REST API via auto-detected method of verifying client identity claim credentials. " + "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + - "in the format 'Authorization: Bearer '." - ) - @ApiResponses( - { + "in the format 'Authorization: Bearer '.", + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with username/password."), - @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500) + } ) public Response createAccessTokenByTryingAllProviders(@Context HttpServletRequest httpServletRequest) { @@ -251,14 +248,14 @@ public Response createAccessTokenByTryingAllProviders(@Context HttpServletReques "That is: 'Authorization: Basic ', where is the base64 encoded value of ':'. " + "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + - "in the format 'Authorization: Bearer '." - ) - @ApiResponses( - { + "in the format 'Authorization: Bearer '.", + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with username/password."), - @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500) + } ) public Response createAccessTokenUsingBasicAuthCredentials(@Context HttpServletRequest httpServletRequest) { @@ -305,10 +302,8 @@ public Response createAccessTokenUsingBasicAuthCredentials(@Context HttpServletR @Path("/logout") @Operation( summary = "Performs a logout for other providers that have been issued a JWT.", - description = NON_GUARANTEED_ENDPOINT - ) - @ApiResponses( - value = { + description = NON_GUARANTEED_ENDPOINT, + responses = { @ApiResponse(responseCode = "200", description = "User was logged out successfully."), @ApiResponse(responseCode = "401", description = "Authentication token provided was empty or not in the correct JWT format."), @ApiResponse(responseCode = "500", description = "Client failed to log out."), @@ -341,10 +336,8 @@ public Response logout(@Context HttpServletRequest httpServletRequest, @Context @Path("/logout/complete") @Operation( summary = "Completes the logout sequence.", - description = NON_GUARANTEED_ENDPOINT - ) - @ApiResponses( - value = { + description = NON_GUARANTEED_ENDPOINT, + responses = { @ApiResponse(responseCode = "200", description = "User was logged out successfully."), @ApiResponse(responseCode = "401", description = "Authentication token provided was empty or not in the correct JWT format."), @ApiResponse(responseCode = "500", description = "Client failed to log out."), @@ -368,14 +361,14 @@ public void logoutComplete(@Context HttpServletRequest httpServletRequest, @Cont description = "Creates a token for accessing the REST API via Kerberos Service Tickets or SPNEGO Tokens (which includes Kerberos Service Tickets). " + "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + - "in the format 'Authorization: Bearer '." - ) - @ApiResponses( - { + "in the format 'Authorization: Bearer '.", + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login Kerberos credentials."), - @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500) + } ) public Response createAccessTokenUsingKerberosTicket(@Context HttpServletRequest httpServletRequest) { @@ -427,14 +420,14 @@ public Response createAccessTokenUsingKerberosTicket(@Context HttpServletRequest "The exact format of the user credentials expected by the custom identity provider can be discovered by 'GET /access/token/identity-provider/usage'. " + "The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, " + "the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header " + - "in the format 'Authorization: Bearer '." - ) - @ApiResponses( - { + "in the format 'Authorization: Bearer '.", + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), - @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500) + } ) public Response createAccessTokenUsingIdentityProviderCredentials(@Context HttpServletRequest httpServletRequest) { @@ -481,13 +474,13 @@ public Response createAccessTokenUsingIdentityProviderCredentials(@Context HttpS @Path("/token/identity-provider/usage") @Operation( summary = "Get identity provider usage", - description = "Provides a description of how the currently configured identity provider expects credentials to be passed to POST /access/token/identity-provider" - ) - @ApiResponses( - { + description = "Provides a description of how the currently configured identity provider expects credentials to be passed to POST /access/token/identity-provider", + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), - @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500) + } ) public Response getIdentityProviderUsageInstructions(@Context HttpServletRequest httpServletRequest) { @@ -526,14 +519,14 @@ public Response getIdentityProviderUsageInstructions(@Context HttpServletRequest @Operation( summary = "Test identity provider", description = "Tests the format of the credentials against this identity provider without preforming authentication on the credentials to validate them. " + - "The user credentials should be passed in a format understood by the custom identity provider as defined by 'GET /access/token/identity-provider/usage'." - ) - @ApiResponses( - { + "The user credentials should be passed in a format understood by the custom identity provider as defined by 'GET /access/token/identity-provider/usage'.", + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = String.class))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = "The format of the credentials were not recognized by the currently configured identity provider."), @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry may not be configured to support login with customized credentials."), - @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500)} + @ApiResponse(responseCode = "500", description = HttpStatusMessages.MESSAGE_500) + } ) public Response testIdentityProviderRecognizesCredentialsFormat(@Context HttpServletRequest httpServletRequest) { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketBundleResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketBundleResource.java index 57f6a7c30e94..b4e49e4c78aa 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketBundleResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketBundleResource.java @@ -16,10 +16,6 @@ */ package org.apache.nifi.registry.web.api; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -28,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -51,6 +46,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + @Component @Path("/buckets/{bucketId}/bundles") @Tag(name = "BucketBundles") @@ -78,7 +77,14 @@ public BucketBundleResource(final ServiceFacade serviceFacade, final EventServic "If supplied, then this value will be compared against the SHA-256 computed by the server, and the bundle " + "will be rejected if the values do not match. If not supplied, the bundle will be accepted, but will be marked " + "to indicate that the client did not supply a SHA-256 during creation. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BundleVersion.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = BundleVersion.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -87,14 +93,6 @@ public BucketBundleResource(final ServiceFacade serviceFacade, final EventServic ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response createExtensionBundleVersion( @PathParam("bucketId") @Parameter(description = "The bucket identifier", required = true) final String bucketId, @@ -121,7 +119,14 @@ public Response createExtensionBundleVersion( @Operation( summary = "Get extension bundles by bucket", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bundle.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bundle.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -130,14 +135,6 @@ public Response createExtensionBundleVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response getExtensionBundles( @PathParam("bucketId") @Parameter(description = "The bucket identifier", required = true) final String bucketId) { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java index 7c852b92fb56..9b0ee07addda 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java @@ -16,10 +16,6 @@ */ package org.apache.nifi.registry.web.api; -import java.net.URI; -import java.util.List; -import java.util.SortedSet; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -28,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.BadRequestException; @@ -63,6 +58,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.net.URI; +import java.util.List; +import java.util.SortedSet; + @Component @Path("/buckets/{bucketId}/flows") @Tag(name = "BucketFlows") @@ -79,7 +78,14 @@ public BucketFlowResource(final ServiceFacade serviceFacade, final EventService @Operation( summary = "Create flow", description = "Creates a flow in the given bucket. The flow id is created by the server and populated in the returned entity.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -88,15 +94,6 @@ public BucketFlowResource(final ServiceFacade serviceFacade, final EventService ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response createFlow( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -115,7 +112,14 @@ public Response createFlow( @Operation( summary = "Get bucket flows", description = "Retrieves all flows in the given bucket.", - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlow.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlow.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -124,15 +128,6 @@ public Response createFlow( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getFlows( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId) { @@ -148,7 +143,14 @@ public Response getFlows( @Operation( summary = "Get bucket flow", description = "Retrieves the flow with the given id in the given bucket.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -157,15 +159,6 @@ public Response getFlows( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getFlow( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -183,7 +176,14 @@ public Response getFlow( @Operation( summary = "Update bucket flow", description = "Updates the flow with the given id in the given bucket.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -192,15 +192,6 @@ public Response getFlow( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response updateFlow( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -225,7 +216,13 @@ public Response updateFlow( @Operation( summary = "Delete bucket flow", description = "Deletes a flow, including all saved versions of that flow.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -234,14 +231,6 @@ public Response updateFlow( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response deleteFlow( @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) @QueryParam(VERSION) final LongParameter version, @@ -268,7 +257,14 @@ public Response deleteFlow( summary = "Create flow version", description = "Creates the next version of a flow. The version number of the object being created must be the " + "next available version integer. Flow versions are immutable after they are created.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -277,15 +273,6 @@ public Response deleteFlow( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response createFlowVersion( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -326,7 +313,14 @@ public Response createFlowVersion( summary = "Import flow version", description = "Import the next version of a flow. The version number of the object being created will be the " + "next available version integer. Flow versions are immutable after they are created.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + responses = { + @ApiResponse(responseCode = "201", description = HttpStatusMessages.MESSAGE_201, content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -335,16 +329,6 @@ public Response createFlowVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "201", description = HttpStatusMessages.MESSAGE_201), - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response importVersionedFlow( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -366,7 +350,13 @@ public Response importVersionedFlow( @Operation( summary = "Get bucket flow versions", description = "Gets summary information for all versions of a flow. Versions are ordered newest->oldest.", - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class)))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -375,14 +365,6 @@ public Response importVersionedFlow( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getFlowVersions( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -400,7 +382,13 @@ public Response getFlowVersions( @Operation( summary = "Get latest bucket flow version content", description = "Gets the latest version of a flow, including the metadata and content of the flow.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -409,14 +397,6 @@ public Response getFlowVersions( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getLatestFlowVersion( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -434,7 +414,13 @@ public Response getLatestFlowVersion( @Operation( summary = "Get latest bucket flow version metadata", description = "Gets the metadata for the latest version of a flow.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -443,14 +429,6 @@ public Response getLatestFlowVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getLatestFlowVersionMetadata( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -468,7 +446,13 @@ public Response getLatestFlowVersionMetadata( @Operation( summary = "Exports specified bucket flow version content", description = "Exports the specified version of a flow, including the metadata and content of the flow.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -477,14 +461,6 @@ public Response getLatestFlowVersionMetadata( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response exportVersionedFlow( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -514,7 +490,14 @@ public Response exportVersionedFlow( @Operation( summary = "Get bucket flow version", description = "Gets the given version of a flow, including the metadata and content for the version.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -523,15 +506,6 @@ public Response exportVersionedFlow( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getFlowVersion( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -551,7 +525,14 @@ public Response getFlowVersion( @Operation( summary = "Get bucket flow diff", description = "Computes the differences between two given versions of a flow.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowDifference.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowDifference.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -560,15 +541,6 @@ public Response getFlowVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getFlowDiff( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java index 18878a891fd1..c80f576ee54d 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketResource.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.registry.web.api; -import java.util.List; -import java.util.Set; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -27,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.BadRequestException; import jakarta.ws.rs.Consumes; @@ -54,6 +50,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Set; + @Component @Path("/buckets") @Tag(name = "Buckets") @@ -69,7 +68,12 @@ public BucketResource(final ServiceFacade serviceFacade, final EventService even @Produces(MediaType.APPLICATION_JSON) @Operation( summary = "Create bucket", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bucket.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Bucket.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -78,13 +82,6 @@ public BucketResource(final ServiceFacade serviceFacade, final EventService even ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403) - } - ) public Response createBucket( @Parameter(description = "The bucket to create", required = true) final Bucket bucket, @Parameter(description = "Whether source properties like identifier should be kept") @@ -102,9 +99,11 @@ public Response createBucket( summary = "Get all buckets", description = "The returned list will include only buckets for which the user is authorized." + "If the user is not authorized for any buckets, this returns an empty list.", - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bucket.class)))) + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bucket.class)))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401) + } ) - @ApiResponses({@ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)}) public Response getBuckets() { // ServiceFacade will determine which buckets the user is authorized for // Note: We don't explicitly check for access to (READ, /buckets) because @@ -125,7 +124,12 @@ public Response getBuckets() { @Operation( summary = "Get bucket", description = "Gets the bucket with the given id.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bucket.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Bucket.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -134,13 +138,6 @@ public Response getBuckets() { ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) - } - ) public Response getBucket( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId) { @@ -156,7 +153,14 @@ public Response getBucket( @Operation( summary = "Update bucket", description = "Updates the bucket with the given id.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bucket.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Bucket.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -165,15 +169,6 @@ public Response getBucket( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response updateBucket( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId, @@ -205,7 +200,13 @@ public Response updateBucket( @Operation( summary = "Delete bucket", description = "Deletes the bucket with the given id, along with all objects stored in the bucket", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bucket.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Bucket.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -214,14 +215,6 @@ public Response updateBucket( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) - } - ) public Response deleteBucket( @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) @QueryParam(VERSION) final LongParameter version, diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BundleResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BundleResource.java index f0b39784fc13..613be0dd0c00 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BundleResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BundleResource.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.registry.web.api; -import java.util.List; -import java.util.SortedSet; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -27,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -52,6 +48,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.SortedSet; + @Component @Path("/bundles") @Tag(name = "Bundles") @@ -74,9 +73,11 @@ public BundleResource(final ServiceFacade serviceFacade, final EventService even description = "Gets the metadata for all bundles across all authorized buckets with optional filters applied. " + "The returned results will include only items from buckets for which the user is authorized. " + "If the user is not authorized to any buckets, an empty list will be returned. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bundle.class)))) + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Bundle.class)))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401) + } ) - @ApiResponses({@ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)}) public Response getBundles( @QueryParam("bucketName") @Parameter( @@ -108,7 +109,14 @@ public Response getBundles( @Operation( summary = "Get bundle", description = "Gets the metadata about an extension bundle. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bundle.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Bundle.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -117,15 +125,6 @@ public Response getBundles( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getBundle( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId) { @@ -141,7 +140,14 @@ public Response getBundle( @Operation( summary = "Delete bundle", description = "Deletes the given extension bundle and all of it's versions. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = Bundle.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = Bundle.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -150,15 +156,6 @@ public Response getBundle( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response deleteBundle( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId) { @@ -178,9 +175,11 @@ public Response deleteBundle( summary = "Get all bundle versions", description = "Gets the metadata about extension bundle versions across all authorized buckets with optional filters applied. " + "If the user is not authorized to any buckets, an empty list will be returned. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = BundleVersionMetadata.class)))) + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = BundleVersionMetadata.class)))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401) + } ) - @ApiResponses({@ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)}) public Response getBundleVersions( @QueryParam("groupId") @Parameter( @@ -211,7 +210,14 @@ public Response getBundleVersions( @Operation( summary = "Get bundle versions", description = "Gets the metadata for the versions of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = BundleVersionMetadata.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = BundleVersionMetadata.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -220,15 +226,6 @@ public Response getBundleVersions( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getBundleVersions( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId) { @@ -244,7 +241,14 @@ public Response getBundleVersions( @Operation( summary = "Get bundle version", description = "Gets the descriptor for the given version of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BundleVersion.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = BundleVersion.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -253,15 +257,6 @@ public Response getBundleVersions( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getBundleVersion( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId, @@ -279,7 +274,14 @@ public Response getBundleVersion( @Operation( summary = "Get bundle version content", description = "Gets the binary content for the given version of the given extension bundle. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = byte[].class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = byte[].class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -288,15 +290,6 @@ public Response getBundleVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getBundleVersionContent( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId, @@ -320,7 +313,14 @@ public Response getBundleVersionContent( @Operation( summary = "Delete bundle version", description = "Deletes the given extension bundle version and it's associated binary content. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = BundleVersion.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = BundleVersion.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -329,14 +329,6 @@ public Response getBundleVersionContent( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response deleteBundleVersion( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId, @@ -355,7 +347,14 @@ public Response deleteBundleVersion( @Operation( summary = "Get bundle version extensions", description = "Gets the metadata about the extensions in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionMetadata.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionMetadata.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -364,14 +363,6 @@ public Response deleteBundleVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response getBundleVersionExtensions( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId, @@ -389,7 +380,14 @@ public Response getBundleVersionExtensions( @Operation( summary = "Get bundle version extension", description = "Gets the metadata about the extension with the given name in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = org.apache.nifi.extension.manifest.Extension.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = org.apache.nifi.extension.manifest.Extension.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -398,15 +396,6 @@ public Response getBundleVersionExtensions( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getBundleVersionExtension( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId, @@ -428,6 +417,14 @@ public Response getBundleVersionExtension( @Operation( summary = "Get bundle version extension docs", description = "Gets the documentation for the given extension in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, + responses = { + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -436,15 +433,6 @@ public Response getBundleVersionExtension( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getBundleVersionExtensionDocs( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId, @@ -464,6 +452,14 @@ public Response getBundleVersionExtensionDocs( @Operation( summary = "Get bundle version extension docs details", description = "Gets the additional details documentation for the given extension in the given extension bundle version. " + NON_GUARANTEED_ENDPOINT, + responses = { + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -472,15 +468,6 @@ public Response getBundleVersionExtensionDocs( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getBundleVersionExtensionAdditionalDetailsDocs( @PathParam("bundleId") @Parameter(description = "The extension bundle identifier") final String bundleId, diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ConfigResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ConfigResource.java index 5c80fd919ec9..eeb340d6b6ae 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ConfigResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ConfigResource.java @@ -22,7 +22,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -54,7 +53,11 @@ public ConfigResource( @Operation( summary = "Get configration", description = "Gets the NiFi Registry configurations.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = RegistryConfiguration.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = RegistryConfiguration.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -63,11 +66,6 @@ public ConfigResource( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)} - ) public Response getConfiguration() { final RegistryConfiguration config = serviceFacade.getRegistryConfiguration(); return Response.status(Response.Status.OK).entity(config).build(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionRepoResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionRepoResource.java index b7ea435b4e04..e031a9e67edb 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionRepoResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionRepoResource.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.registry.web.api; -import java.util.List; -import java.util.SortedSet; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -27,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -54,6 +50,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.SortedSet; + @Component @Path("/extension-repository") @Tag(name = "ExtensionRepository") @@ -72,10 +71,8 @@ public ExtensionRepoResource(final ServiceFacade serviceFacade, final EventServi @Operation( summary = "Get extension repo buckets", description = "Gets the names of the buckets the current user is authorized for in order to browse the repo by bucket. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoBucket.class)))) - ) - @ApiResponses( - { + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoBucket.class)))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), @@ -95,7 +92,14 @@ public Response getExtensionRepoBuckets() { @Operation( summary = "Get extension repo groups", description = "Gets the groups in the extension repository in the given bucket. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoGroup.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoGroup.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -104,14 +108,6 @@ public Response getExtensionRepoBuckets() { ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response getExtensionRepoGroups( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName @@ -127,7 +123,14 @@ public Response getExtensionRepoGroups( @Operation( summary = "Get extension repo artifacts", description = "Gets the artifacts in the extension repository in the given bucket and group. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoArtifact.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoArtifact.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -136,15 +139,6 @@ public Response getExtensionRepoGroups( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getExtensionRepoArtifacts( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -162,7 +156,14 @@ public Response getExtensionRepoArtifacts( @Operation( summary = "Get extension repo versions", description = "Gets the versions in the extension repository for the given bucket, group, and artifact. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoVersionSummary.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionRepoVersionSummary.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -171,14 +172,6 @@ public Response getExtensionRepoArtifacts( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response getExtensionRepoVersions( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -199,7 +192,14 @@ public Response getExtensionRepoVersions( @Operation( summary = "Get extension repo version", description = "Gets information about the version in the given bucket, group, and artifact. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ExtensionRepoVersion.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ExtensionRepoVersion.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -208,15 +208,6 @@ public Response getExtensionRepoVersions( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getExtensionRepoVersion( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -239,7 +230,14 @@ public Response getExtensionRepoVersion( @Operation( summary = "Get extension repo extensions", description = "Gets information about the extensions in the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionMetadata.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ExtensionMetadata.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -248,15 +246,6 @@ public Response getExtensionRepoVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getExtensionRepoVersionExtensions( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -283,7 +272,14 @@ public Response getExtensionRepoVersionExtensions( summary = "Get extension repo extension", description = "Gets information about the extension with the given name in " + "the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = org.apache.nifi.extension.manifest.Extension.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = org.apache.nifi.extension.manifest.Extension.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -292,15 +288,6 @@ public Response getExtensionRepoVersionExtensions( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getExtensionRepoVersionExtension( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -327,6 +314,14 @@ public Response getExtensionRepoVersionExtension( summary = "Get extension repo extension docs", description = "Gets the documentation for the extension with the given name in " + "the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, + responses = { + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -335,15 +330,6 @@ public Response getExtensionRepoVersionExtension( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getExtensionRepoVersionExtensionDocs( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -369,6 +355,14 @@ public Response getExtensionRepoVersionExtensionDocs( summary = "Get extension repo extension details", description = "Gets the additional details documentation for the extension with the given name in " + "the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, + responses = { + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -377,15 +371,6 @@ public Response getExtensionRepoVersionExtensionDocs( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getExtensionRepoVersionExtensionAdditionalDetailsDocs( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -410,7 +395,14 @@ public Response getExtensionRepoVersionExtensionAdditionalDetailsDocs( @Operation( summary = "Get extension repo version content", description = "Gets the binary content of the bundle with the given bucket, group, artifact, and version. " + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = byte[].class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = byte[].class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -419,15 +411,6 @@ public Response getExtensionRepoVersionExtensionAdditionalDetailsDocs( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getExtensionRepoVersionContent( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -457,6 +440,14 @@ public Response getExtensionRepoVersionContent( summary = "Get extension repo version checksum", description = "Gets the hex representation of the SHA-256 digest for the binary content of the bundle " + "with the given bucket, group, artifact, and version." + NON_GUARANTEED_ENDPOINT, + responses = { + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -465,15 +456,6 @@ public Response getExtensionRepoVersionContent( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getExtensionRepoVersionSha256( @PathParam("bucketName") @Parameter(description = "The bucket name") final String bucketName, @@ -496,10 +478,9 @@ public Response getExtensionRepoVersionSha256( summary = "Get global extension repo version checksum", description = "Gets the hex representation of the SHA-256 digest for the binary content with the given bucket, group, artifact, and version. " + "Since the same group-artifact-version can exist in multiple buckets, this will return the checksum of the first one returned. " + - "This will be consistent since the checksum must be the same when existing in multiple buckets. " + NON_GUARANTEED_ENDPOINT - ) - @ApiResponses( - { + "This will be consistent since the checksum must be the same when existing in multiple buckets. " + NON_GUARANTEED_ENDPOINT, + responses = { + @ApiResponse(responseCode = "200"), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionResource.java index a984a7c31671..dc383b244256 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ExtensionResource.java @@ -16,17 +16,12 @@ */ package org.apache.nifi.registry.web.api; -import java.util.Collections; -import java.util.Set; -import java.util.SortedSet; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -46,6 +41,10 @@ import org.apache.nifi.registry.web.service.ServiceFacade; import org.springframework.stereotype.Component; +import java.util.Collections; +import java.util.Set; +import java.util.SortedSet; + @Component @Path("/extensions") @Tag(name = "Extensions") @@ -63,15 +62,14 @@ public ExtensionResource(final ServiceFacade serviceFacade, final EventService e description = "Gets the metadata for all extensions that match the filter params and are part of bundles located in buckets the " + "current user is authorized for. If the user is not authorized to any buckets, an empty result set will be returned." + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ExtensionMetadataContainer.class))) - ) - @ApiResponses( - { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ExtensionMetadataContainer.class))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + } ) public Response getExtensions( @QueryParam("bundleType") @@ -107,10 +105,8 @@ public Response getExtensions( description = "Gets the metadata for extensions that provide the specified API and are part of bundles located in buckets the " + "current user is authorized for. If the user is not authorized to any buckets, an empty result set will be returned." + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ExtensionMetadataContainer.class))) - ) - @ApiResponses( - { + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ExtensionMetadataContainer.class))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), @@ -151,10 +147,8 @@ public Response getExtensionsProvidingServiceAPI( summary = "Get extension tags", description = "Gets all the extension tags known to this NiFi Registry instance, along with the " + "number of extensions that have the given tag." + NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = TagCount.class)))) - ) - @ApiResponses( - { + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = TagCount.class)))), @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java index 3eea6ecc5ade..d370ceab4ce3 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/FlowResource.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.registry.web.api; -import java.util.Set; -import java.util.SortedSet; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -27,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -45,6 +41,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.Set; +import java.util.SortedSet; + @Component @Path("/flows") @Tag(name = "Flows") @@ -77,7 +76,14 @@ public Response getAvailableFlowFields() { @Operation( summary = "Get flow", description = "Gets a flow by id.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlow.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -86,15 +92,6 @@ public Response getAvailableFlowFields() { ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getFlow( @PathParam("flowId") @Parameter(description = "The flow identifier") final String flowId) { @@ -110,7 +107,13 @@ public Response getFlow( @Operation( summary = "Get flow versions", description = "Gets summary information for all versions of a given flow. Versions are ordered newest->oldest.", - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class)))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -119,14 +122,6 @@ public Response getFlow( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getFlowVersions( @PathParam("flowId") @Parameter(description = "The flow identifier") final String flowId) { @@ -142,7 +137,14 @@ public Response getFlowVersions( @Operation( summary = "Get flow version", description = "Gets the given version of a flow, including metadata and flow content.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -151,15 +153,6 @@ public Response getFlowVersions( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getFlowVersion( @PathParam("flowId") @Parameter(description = "The flow identifier") final String flowId, @@ -177,7 +170,13 @@ public Response getFlowVersion( @Operation( summary = "Get latest flow version", description = "Gets the latest version of a flow, including metadata and flow content.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshot.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -186,14 +185,6 @@ public Response getFlowVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getLatestFlowVersion( @PathParam("flowId") @Parameter(description = "The flow identifier") final String flowId) { @@ -209,7 +200,13 @@ public Response getLatestFlowVersion( @Operation( summary = "Get latest flow version metadata", description = "Gets the metadata for the latest version of a flow.", - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = VersionedFlowSnapshotMetadata.class))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -218,14 +215,6 @@ public Response getLatestFlowVersion( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getLatestFlowVersionMetadata( @PathParam("flowId") @Parameter(description = "The flow identifier") final String flowId) { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ItemResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ItemResource.java index b60ab3b4e57c..16d55d39505f 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ItemResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ItemResource.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.registry.web.api; -import java.util.List; -import java.util.Set; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -27,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -45,6 +41,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Set; + @Component @Path("/items") @Tag(name = "Items") @@ -66,9 +65,11 @@ public ItemResource(final ServiceFacade serviceFacade, final EventService eventS summary = "Get all items", description = "Get items across all buckets. The returned items will include only items from buckets for which the user is authorized. " + "If the user is not authorized to any buckets, an empty list will be returned.", - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = BucketItem.class)))) + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = BucketItem.class)))), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401) + } ) - @ApiResponses({@ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401)}) public Response getItems() { // Service facade with return only items from authorized buckets // Note: We don't explicitly check for access to (READ, /buckets) or @@ -89,7 +90,13 @@ public Response getItems() { @Operation( summary = "Get bucket items", description = "Gets the items located in the given bucket.", - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = BucketItem.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = BucketItem.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -98,14 +105,6 @@ public Response getItems() { ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404) - } - ) public Response getItems( @PathParam("bucketId") @Parameter(description = "The bucket identifier") final String bucketId) { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/TenantResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/TenantResource.java index 935ef6c680d7..77d9114228fc 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/TenantResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/TenantResource.java @@ -16,9 +16,6 @@ */ package org.apache.nifi.registry.web.api; -import java.net.URI; -import java.util.List; - import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.extensions.Extension; @@ -27,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.ws.rs.Consumes; @@ -55,6 +51,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.net.URI; +import java.util.List; + /** * RESTful endpoints for managing tenants, ie, users and user groups. */ @@ -86,7 +85,14 @@ public TenantResource(final ServiceFacade serviceFacade, @Operation( summary = "Create user", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = User.class))), + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = User.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -95,14 +101,6 @@ public TenantResource(final ServiceFacade serviceFacade, ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response createUser( @Context final HttpServletRequest httpServletRequest, @Parameter(description = "The user configuration details.", required = true) final User requestUser) { @@ -126,7 +124,13 @@ public Response createUser( @Operation( summary = "Get all users", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = User.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = User.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -135,13 +139,6 @@ public Response createUser( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response getUsers() { // get all the users final List users = serviceFacade.getUsers(); @@ -163,7 +160,14 @@ public Response getUsers() { @Operation( summary = "Get user", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = User.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = User.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -172,14 +176,6 @@ public Response getUsers() { ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response getUser( @Parameter(description = "The user id.", required = true) @PathParam("id") final String identifier) { @@ -202,7 +198,14 @@ public Response getUser( @Operation( summary = "Update user", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = User.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = User.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -211,15 +214,6 @@ public Response getUser( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response updateUser( @Context final HttpServletRequest httpServletRequest, @Parameter(description = "The user id.", required = true) @@ -253,7 +247,14 @@ public Response updateUser( @Operation( summary = "Delete user", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = User.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = User.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -262,15 +263,6 @@ public Response updateUser( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response removeUser( @Context final HttpServletRequest httpServletRequest, @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true) @@ -304,7 +296,14 @@ public Response removeUser( @Operation( summary = "Create user group", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroup.class))), + responses = { + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = UserGroup.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -313,15 +312,6 @@ public Response removeUser( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response createUserGroup( @Context final HttpServletRequest httpServletRequest, @Parameter(description = "The user group configuration details.", required = true) final UserGroup requestUserGroup) { @@ -345,7 +335,14 @@ public Response createUserGroup( @Operation( summary = "Get user groups", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = UserGroup.class)))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = UserGroup.class)))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -354,14 +351,6 @@ public Response createUserGroup( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409)} - ) public Response getUserGroups() { final List userGroups = serviceFacade.getUserGroups(); return generateOkResponse(userGroups).build(); @@ -380,7 +369,14 @@ public Response getUserGroups() { @Operation( summary = "Get user group", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroup.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserGroup.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -389,15 +385,6 @@ public Response getUserGroups() { ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response getUserGroup( @Parameter(description = "The user group id.", required = true) @PathParam("id") final String identifier) { @@ -420,7 +407,14 @@ public Response getUserGroup( @Operation( summary = "Update user group", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroup.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserGroup.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -429,15 +423,6 @@ public Response getUserGroup( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response updateUserGroup( @Context final HttpServletRequest httpServletRequest, @Parameter(description = "The user group id.", required = true) @@ -471,7 +456,14 @@ public Response updateUserGroup( @Operation( summary = "Delete user group", description = NON_GUARANTEED_ENDPOINT, - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UserGroup.class))), + responses = { + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = UserGroup.class))), + @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), + @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), + @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), + @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), + @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) + }, extensions = { @Extension( name = "access-policy", properties = { @@ -480,15 +472,6 @@ public Response updateUserGroup( ) } ) - @ApiResponses( - { - @ApiResponse(responseCode = "400", description = HttpStatusMessages.MESSAGE_400), - @ApiResponse(responseCode = "401", description = HttpStatusMessages.MESSAGE_401), - @ApiResponse(responseCode = "403", description = HttpStatusMessages.MESSAGE_403), - @ApiResponse(responseCode = "404", description = HttpStatusMessages.MESSAGE_404), - @ApiResponse(responseCode = "409", description = HttpStatusMessages.MESSAGE_409) - } - ) public Response removeUserGroup( @Context final HttpServletRequest httpServletRequest, @Parameter(description = "The version is used to verify the client is working with the latest version of the entity.", required = true)