Skip to content

Commit 5ef4390

Browse files
committed
[KYUUBI #6045] [REST] Sync the AdminRestApi with the AdminResource Apis
# 🔍 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 🔖 - [ ] 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 ⚰️ #### Behavior With This Pull Request 🎉 #### 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 ce017b8 [Fei Wang] api Authored-by: Fei Wang <fwang12@ebay.com> Signed-off-by: Fei Wang <fwang12@ebay.com>
1 parent 5f99ec8 commit 5ef4390

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/AdminRestApi.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.kyuubi.client;
1919

2020
import java.util.*;
21+
import org.apache.commons.lang3.StringUtils;
2122
import org.apache.kyuubi.client.api.v1.dto.Engine;
2223
import org.apache.kyuubi.client.api.v1.dto.OperationData;
2324
import org.apache.kyuubi.client.api.v1.dto.ServerData;
@@ -103,10 +104,24 @@ public String closeSession(String sessionHandleStr) {
103104
}
104105

105106
public List<OperationData> listOperations() {
107+
return listOperations(Collections.emptyList(), null);
108+
}
109+
110+
public List<OperationData> listOperations(List<String> users, String sessionHandleStr) {
111+
Map<String, Object> params = new HashMap<>();
112+
if (users != null && !users.isEmpty()) {
113+
params.put("users", String.join(",", users));
114+
}
115+
if (StringUtils.isNotBlank(sessionHandleStr)) {
116+
params.put("sessionHandle", sessionHandleStr);
117+
}
106118
OperationData[] result =
107119
this.getClient()
108120
.get(
109-
API_BASE_PATH + "/operations", null, OperationData[].class, client.getAuthHeader());
121+
API_BASE_PATH + "/operations",
122+
params,
123+
OperationData[].class,
124+
client.getAuthHeader());
110125
return Arrays.asList(result);
111126
}
112127

0 commit comments

Comments
 (0)