This is an automated email from the ASF dual-hosted git repository. chengpan pushed a commit to branch branch-1.8 in repository https://gitbox.apache.org/repos/asf/kyuubi.git
commit 955cf7bfcbaa71c5bc5432a9adca612dd40cf2cb Author: Fei Wang <[email protected]> AuthorDate: Mon Feb 5 09:39:09 2024 -0800 [KYUUBI #6045] [REST] Sync the AdminRestApi with the AdminResource Apis # :mag: Description ## Issue References ๐ https://github.com/apache/kyuubi/blob/f67140e650d4fb335b43a65eb2678192c9b0b29a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/AdminResource.scala#L196-L198 Support to filter operations with users and sessionHandle in AdminRestApi This pull request fixes # ## Describe Your Solution ๐ง Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ## Types of changes :bookmark: - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐งช #### Behavior Without This Pull Request :coffin: #### Behavior With This Pull Request :tada: #### Related Unit Tests --- # Checklist ๐ - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #6045 from turboFei/list_op. Closes #6045 ce017b822 [Fei Wang] api Authored-by: Fei Wang <[email protected]> Signed-off-by: Fei Wang <[email protected]> (cherry picked from commit 5ef4390b23cd8d26faaa785becb0a6c81b9d45e0) Signed-off-by: Fei Wang <[email protected]> --- .../java/org/apache/kyuubi/client/AdminRestApi.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/AdminRestApi.java b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/AdminRestApi.java index 3e59d0c5b..834b508de 100644 --- a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/AdminRestApi.java +++ b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/AdminRestApi.java @@ -18,6 +18,7 @@ package org.apache.kyuubi.client; import java.util.*; +import org.apache.commons.lang3.StringUtils; import org.apache.kyuubi.client.api.v1.dto.Engine; import org.apache.kyuubi.client.api.v1.dto.OperationData; import org.apache.kyuubi.client.api.v1.dto.ServerData; @@ -103,10 +104,24 @@ public class AdminRestApi { } public List<OperationData> listOperations() { + return listOperations(Collections.emptyList(), null); + } + + public List<OperationData> listOperations(List<String> users, String sessionHandleStr) { + Map<String, Object> params = new HashMap<>(); + if (users != null && !users.isEmpty()) { + params.put("users", String.join(",", users)); + } + if (StringUtils.isNotBlank(sessionHandleStr)) { + params.put("sessionHandle", sessionHandleStr); + } OperationData[] result = this.getClient() .get( - API_BASE_PATH + "/operations", null, OperationData[].class, client.getAuthHeader()); + API_BASE_PATH + "/operations", + params, + OperationData[].class, + client.getAuthHeader()); return Arrays.asList(result); }
