Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenliang123 committed Sep 19, 2024
1 parent 323ffc8 commit 8a88062
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,29 @@

package org.apache.kyuubi.ctl.cmd.list

import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer

import org.apache.kyuubi.client.AdminRestApi
import org.apache.kyuubi.config.ConfigEntry
import org.apache.kyuubi.client.api.v1.dto.ConfigEntry
import org.apache.kyuubi.ctl.RestClientFactory.withKyuubiRestClient
import org.apache.kyuubi.ctl.cmd.AdminCtlCommand
import org.apache.kyuubi.ctl.opt.CliConfig
import org.apache.kyuubi.ctl.util.Render

class AdminListConfigCommand(cliConfig: CliConfig)
extends AdminCtlCommand[Iterable[ConfigEntry[Any]]](cliConfig) {
extends AdminCtlCommand[Iterable[ConfigEntry]](cliConfig) {

override def validate(): Unit = {}

override def doRun(): Iterable[ConfigEntry[Any]] = {
override def doRun(): Iterable[ConfigEntry] = {
withKyuubiRestClient(normalizedCliConfig, null, conf) { kyuubiRestClient =>
val adminRestApi = new AdminRestApi(kyuubiRestClient)
// todo: impl
adminRestApi.listConfigs()
Seq[ConfigEntry[Any]]()
adminRestApi.listConfigs().asScala
}
}

override def render(resp: Iterable[ConfigEntry[Any]]): Unit = {
// info(Render.renderEngineNodesInfo(resp))
// todo: impl
override def render(resp: Iterable[ConfigEntry]): Unit = {
info(Render.renderConfigsInfo(resp))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.kyuubi.ctl.util
import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer

import org.apache.kyuubi.client.api.v1.dto.{Batch, Engine, GetBatchesResponse, ServerData, SessionData}
import org.apache.kyuubi.client.api.v1.dto.{Batch, ConfigEntry, Engine, GetBatchesResponse, ServerData, SessionData}
import org.apache.kyuubi.ctl.util.DateTimeUtils._
import org.apache.kyuubi.ha.client.ServiceNodeInfo

Expand All @@ -33,6 +33,13 @@ private[ctl] object Render {
Tabulator.format(title, header, rows)
}

def renderConfigsInfo(configsInfo: Iterable[ConfigEntry]): String = {
val title = s"Server Configs List (total ${configsInfo.size})"
val header = Array("Namespace", "Instance", "Attributes")
val rows = configsInfo.map { entry => Array(entry.getKey, entry.getValue) }.toArray
Tabulator.format(title, header, rows)
}

def renderEngineNodesInfo(engineNodesInfo: Iterable[Engine]): String = {
val title = s"Engine Node List (total ${engineNodesInfo.size})"
val header = Array("Namespace", "Instance", "Attributes")
Expand Down

0 comments on commit 8a88062

Please sign in to comment.