TaiJuWu commented on code in PR #20598:
URL: https://github.com/apache/kafka/pull/20598#discussion_r3525934323


##########
tools/src/main/java/org/apache/kafka/tools/ClusterTool.java:
##########
@@ -208,4 +222,23 @@ static void listEndpoints(PrintStream stream, Admin 
adminClient, boolean listCon
             }
         }
     }
+
+    static void apiVersionsCommand(PrintStream stream, Admin adminClient) 
throws Exception {
+        Collection<Node> nodes = adminClient.describeCluster().nodes().get();
+        Map<Node, InternalDescribeFeaturesResult> nodeApiVersions = new 
TreeMap<>(Comparator.comparingInt(Node::id));
+        nodes.forEach(node -> {
+            InternalDescribeFeaturesResult result = 
(InternalDescribeFeaturesResult) adminClient.describeFeatures(
+                    new DescribeFeaturesOptions().nodeId(node.id()));
+            nodeApiVersions.put(node, result);
+        });
+
+        nodeApiVersions.forEach((broker, future) -> {
+            try {
+                NodeApiVersions apiVersions = future.nodeApiVersions().get();
+                stream.print(broker + " -> " + apiVersions.toString(true) + 
"\n");

Review Comment:
   This output is specific from 
[KIP](https://cwiki.apache.org/confluence/spaces/KAFKA/pages/387647997/KIP-1220+Unify+kafka-broker-api-versions+tool+to+cluster-tool+and+support+bootstrap+controllers).
   The goal is align old output, thanks!
   
   <img width="1073" height="172" alt="image" 
src="https://github.com/user-attachments/assets/a8085657-9570-4ca6-8cb9-f162e093e0e9";
 />
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to