|
16 | 16 | */
|
17 | 17 | package org.apache.nifi.web.api;
|
18 | 18 |
|
19 |
| -import java.net.URI; |
20 |
| - |
21 | 19 | import io.swagger.v3.oas.annotations.Operation;
|
22 | 20 | import io.swagger.v3.oas.annotations.Parameter;
|
23 | 21 | import io.swagger.v3.oas.annotations.media.Content;
|
24 | 22 | import io.swagger.v3.oas.annotations.media.Schema;
|
25 | 23 | import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
26 |
| -import io.swagger.v3.oas.annotations.responses.ApiResponses; |
27 | 24 | import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
28 | 25 | import io.swagger.v3.oas.annotations.tags.Tag;
|
29 | 26 | import jakarta.ws.rs.Consumes;
|
|
60 | 57 | import org.springframework.beans.factory.annotation.Autowired;
|
61 | 58 | import org.springframework.stereotype.Controller;
|
62 | 59 |
|
| 60 | +import java.net.URI; |
| 61 | + |
63 | 62 | /**
|
64 | 63 | * RESTful endpoint for managing access policies.
|
65 | 64 | */
|
@@ -120,18 +119,16 @@ public AccessPolicyEntity populateRemainingAccessPolicyEntityContent(AccessPolic
|
120 | 119 | + "have permissions to that policy, the response will not include the policy and the permissions in the response "
|
121 | 120 | + "will be marked accordingly. If the client does not have permissions to the policy of the desired action and resource "
|
122 | 121 | + "a 403 response will be returned.",
|
123 |
| - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
124 |
| - security = { |
125 |
| - @SecurityRequirement(name = "Read - /policies/{resource}") |
126 |
| - } |
127 |
| - ) |
128 |
| - @ApiResponses( |
129 |
| - value = { |
| 122 | + responses = { |
| 123 | + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
130 | 124 | @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
|
131 | 125 | @ApiResponse(responseCode = "401", description = "Client could not be authenticated."),
|
132 | 126 | @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."),
|
133 | 127 | @ApiResponse(responseCode = "404", description = "The specified resource could not be found."),
|
134 | 128 | @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.")
|
| 129 | + }, |
| 130 | + security = { |
| 131 | + @SecurityRequirement(name = "Read - /policies/{resource}") |
135 | 132 | }
|
136 | 133 | )
|
137 | 134 | public Response getAccessPolicyForResource(
|
@@ -187,18 +184,16 @@ public Response getAccessPolicyForResource(
|
187 | 184 | @Produces(MediaType.APPLICATION_JSON)
|
188 | 185 | @Operation(
|
189 | 186 | summary = "Creates an access policy",
|
190 |
| - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
191 |
| - security = { |
192 |
| - @SecurityRequirement(name = "Write - /policies/{resource}") |
193 |
| - } |
194 |
| - ) |
195 |
| - @ApiResponses( |
196 |
| - value = { |
| 187 | + responses = { |
| 188 | + @ApiResponse(responseCode = "201", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
197 | 189 | @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
|
198 | 190 | @ApiResponse(responseCode = "401", description = "Client could not be authenticated."),
|
199 | 191 | @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."),
|
200 | 192 | @ApiResponse(responseCode = "404", description = "The specified resource could not be found."),
|
201 | 193 | @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.")
|
| 194 | + }, |
| 195 | + security = { |
| 196 | + @SecurityRequirement(name = "Write - /policies/{resource}") |
202 | 197 | }
|
203 | 198 | )
|
204 | 199 | public Response createAccessPolicy(
|
@@ -279,18 +274,16 @@ public Response createAccessPolicy(
|
279 | 274 | @Path("{id}")
|
280 | 275 | @Operation(
|
281 | 276 | summary = "Gets an access policy",
|
282 |
| - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
283 |
| - security = { |
284 |
| - @SecurityRequirement(name = "Read - /policies/{resource}") |
285 |
| - } |
286 |
| - ) |
287 |
| - @ApiResponses( |
288 |
| - value = { |
| 277 | + responses = { |
| 278 | + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
289 | 279 | @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
|
290 | 280 | @ApiResponse(responseCode = "401", description = "Client could not be authenticated."),
|
291 | 281 | @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."),
|
292 | 282 | @ApiResponse(responseCode = "404", description = "The specified resource could not be found."),
|
293 | 283 | @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.")
|
| 284 | + }, |
| 285 | + security = { |
| 286 | + @SecurityRequirement(name = "Read - /policies/{resource}") |
294 | 287 | }
|
295 | 288 | )
|
296 | 289 | public Response getAccessPolicy(
|
@@ -335,18 +328,16 @@ public Response getAccessPolicy(
|
335 | 328 | @Path("{id}")
|
336 | 329 | @Operation(
|
337 | 330 | summary = "Updates a access policy",
|
338 |
| - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
339 |
| - security = { |
340 |
| - @SecurityRequirement(name = "Write - /policies/{resource}") |
341 |
| - } |
342 |
| - ) |
343 |
| - @ApiResponses( |
344 |
| - value = { |
| 331 | + responses = { |
| 332 | + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
345 | 333 | @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
|
346 | 334 | @ApiResponse(responseCode = "401", description = "Client could not be authenticated."),
|
347 | 335 | @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."),
|
348 | 336 | @ApiResponse(responseCode = "404", description = "The specified resource could not be found."),
|
349 | 337 | @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.")
|
| 338 | + }, |
| 339 | + security = { |
| 340 | + @SecurityRequirement(name = "Write - /policies/{resource}") |
350 | 341 | }
|
351 | 342 | )
|
352 | 343 | public Response updateAccessPolicy(
|
@@ -426,19 +417,17 @@ public Response updateAccessPolicy(
|
426 | 417 | @Path("{id}")
|
427 | 418 | @Operation(
|
428 | 419 | summary = "Deletes an access policy",
|
429 |
| - responses = @ApiResponse(content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
430 |
| - security = { |
431 |
| - @SecurityRequirement(name = "Write - /policies/{resource}"), |
432 |
| - @SecurityRequirement(name = "Write - Policy of the parent resource - /policies/{resource}") |
433 |
| - } |
434 |
| - ) |
435 |
| - @ApiResponses( |
436 |
| - value = { |
| 420 | + responses = { |
| 421 | + @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = AccessPolicyEntity.class))), |
437 | 422 | @ApiResponse(responseCode = "400", description = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."),
|
438 | 423 | @ApiResponse(responseCode = "401", description = "Client could not be authenticated."),
|
439 | 424 | @ApiResponse(responseCode = "403", description = "Client is not authorized to make this request."),
|
440 | 425 | @ApiResponse(responseCode = "404", description = "The specified resource could not be found."),
|
441 | 426 | @ApiResponse(responseCode = "409", description = "The request was valid but NiFi was not in the appropriate state to process it.")
|
| 427 | + }, |
| 428 | + security = { |
| 429 | + @SecurityRequirement(name = "Write - /policies/{resource}"), |
| 430 | + @SecurityRequirement(name = "Write - Policy of the parent resource - /policies/{resource}") |
442 | 431 | }
|
443 | 432 | )
|
444 | 433 | public Response removeAccessPolicy(
|
|
0 commit comments