Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/cmd/kafka/topic/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type Options struct {
type topicRow struct {
Name string `json:"name,omitempty" header:"Name"`
PartitionsCount int `json:"partitions_count,omitempty" header:"Partitions"`
RetentionTime string `json:"retention.ms,omitempty" header:"Retention time"`
RetentionSize string `json:"retention.bytes,omitempty" header:"Retention size"`
}

// NewListTopicCommand gets a new command for getting kafkas.
Expand Down Expand Up @@ -168,9 +170,22 @@ func mapTopicResultsToTableFormat(topics []strimziadminclient.Topic) []topicRow
var rows []topicRow = []topicRow{}

for _, t := range topics {
var RetentionTime, RetentionSize string

for _, config := range t.GetConfig() {
if *config.Key == "retention.ms" {
RetentionTime = *config.Value
}
if *config.Key == "retention.bytes" {
RetentionSize = *config.Value
}
}

row := topicRow{
Name: t.GetName(),
PartitionsCount: len(t.GetPartitions()),
RetentionTime: RetentionTime,
RetentionSize: RetentionSize,
}
rows = append(rows, row)
}
Expand Down