|
26 | 26 | import io.swagger.annotations.ApiResponse;
|
27 | 27 | import io.swagger.annotations.ApiResponses;
|
28 | 28 | import java.util.List;
|
29 |
| -import java.util.Map; |
30 | 29 | import java.util.Set;
|
31 | 30 | import java.util.concurrent.CompletableFuture;
|
32 | 31 | import javax.ws.rs.Consumes;
|
@@ -1076,14 +1075,20 @@ public void getReplicatorDispatchRate(
|
1076 | 1075 | @ApiOperation(hidden = true, value = "Get backlog quota map on a namespace.")
|
1077 | 1076 | @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
|
1078 | 1077 | @ApiResponse(code = 404, message = "Namespace does not exist") })
|
1079 |
| - public Map<BacklogQuotaType, BacklogQuota> getBacklogQuotaMap(@PathParam("property") String property, |
| 1078 | + public void getBacklogQuotaMap( |
| 1079 | + @Suspended final AsyncResponse asyncResponse, |
| 1080 | + @PathParam("property") String property, |
1080 | 1081 | @PathParam("cluster") String cluster, @PathParam("namespace") String namespace) {
|
1081 | 1082 | validateNamespaceName(property, cluster, namespace);
|
1082 |
| - validateNamespacePolicyOperation(NamespaceName.get(property, namespace), |
1083 |
| - PolicyName.BACKLOG, PolicyOperation.READ); |
1084 |
| - |
1085 |
| - Policies policies = getNamespacePolicies(namespaceName); |
1086 |
| - return policies.backlog_quota_map; |
| 1083 | + validateNamespacePolicyOperationAsync(namespaceName, PolicyName.BACKLOG, |
| 1084 | + PolicyOperation.READ) |
| 1085 | + .thenCompose(__ -> getNamespacePoliciesAsync(namespaceName)) |
| 1086 | + .thenAccept(policies -> asyncResponse.resume(policies.backlog_quota_map)) |
| 1087 | + .exceptionally(ex -> { |
| 1088 | + log.error("[{}] Failed to get backlog quota map on namespace {}", clientAppId(), namespaceName, ex); |
| 1089 | + resumeAsyncResponseExceptionally(asyncResponse, ex); |
| 1090 | + return null; |
| 1091 | + }); |
1087 | 1092 | }
|
1088 | 1093 |
|
1089 | 1094 | @POST
|
|
0 commit comments