FrankYang0529 commented on code in PR #19808: URL: https://github.com/apache/kafka/pull/19808#discussion_r2107254802
########## core/src/main/scala/kafka/admin/ConfigCommand.scala: ########## @@ -342,6 +342,42 @@ object ConfigCommand extends Logging { } private def describeResourceConfig(adminClient: Admin, entityType: String, entityName: Option[String], describeAll: Boolean): Unit = { + if (!describeAll) { + entityName.foreach { name => + entityType match { + case TopicType => + Topic.validate(name) + if (!adminClient.listTopics(new ListTopicsOptions().listInternal(true)).names.get.contains(name)) { + System.out.println(s"The $entityType '$name' doesn't exist and doesn't have dynamic config.") + return + } + case BrokerType | BrokerLoggerConfigType => + if (adminClient.describeCluster.nodes.get.stream.anyMatch(_.idString == name)) { + // valid broker id + } else if (name == BrokerDefaultEntityName) { + // default broker configs + } else { + System.out.println(s"The $entityType '$name' doesn't exist and doesn't have dynamic config.") + return + } + case ClientMetricsType => + if (adminClient.listConfigResources(java.util.Set.of(ConfigResource.Type.CLIENT_METRICS), new ListConfigResourcesOptions).all.get Review Comment: I prefer to leave this as `java.util.xxx` because we already used this pattern like: https://github.com/apache/kafka/blob/48a52701b9cd45c4854f910990a85be7d73e22f5/core/src/main/scala/kafka/admin/ConfigCommand.scala#L311 We can do some refactor for Scala code in core module after this PR. Or we can refactor it when migrating to Java eventually. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org