Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion internal/kafka/command_link_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (c *linkCommand) describe(cmd *cobra.Command, args []string) error {

table := output.NewTable(cmd)
table.Add(newDescribeLink(link, ""))
table.Filter(getListFields(false))
table.Filter(getListFields(false, false))
return table.Print()
}

Expand Down
10 changes: 7 additions & 3 deletions internal/kafka/command_link_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,20 @@ func (c *linkCommand) list(cmd *cobra.Command, _ []string) error {
list.Add(newLink(link, ""))
}
}
list.Filter(getListFields(includeTopics))
list.Filter(getListFields(includeTopics, true))
return list.Print()
}

func getListFields(includeTopics bool) []string {
func getListFields(includeTopics bool, isListLink bool) []string {
x := []string{"Name"}

if includeTopics {
x = append(x, "TopicName")
}

return append(x, "SourceCluster", "DestinationCluster", "RemoteCluster", "State", "Error", "ErrorMessage")
if isListLink {
return append(x, "RemoteCluster", "State", "Error", "ErrorMessage")
} else {
return append(x, "SourceCluster", "DestinationCluster", "RemoteCluster", "State", "Error", "ErrorMessage")
}
}
6 changes: 0 additions & 6 deletions test/fixtures/output/kafka/link/list-link-json.golden
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
[
{
"link_name": "link-1",
"source_cluster": "cluster-1",
"destination_cluster": "cluster-2",
"state": ""
},
{
"link_name": "link-2",
"source_cluster": "cluster-1",
"destination_cluster": "cluster-2",
"state": "AVAILABLE"
},
{
"link_name": "link-3",
"source_cluster": "cluster-1",
"destination_cluster": "cluster-2",
"state": "UNAVAILABLE",
"error": "AUTHENTICATION_ERROR",
"error_message": "Please check your API key and secret."
Expand Down
16 changes: 8 additions & 8 deletions test/fixtures/output/kafka/link/list-link-plain.golden
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Name | Source Cluster | Destination Cluster | Remote Cluster | State | Error | Error Message
---------+----------------+---------------------+----------------+-------------+----------------------+---------------------------------
link-1 | cluster-1 | cluster-2 | | | |
link-2 | cluster-1 | cluster-2 | | AVAILABLE | |
link-3 | cluster-1 | cluster-2 | | UNAVAILABLE | AUTHENTICATION_ERROR | Please check your API key and
| | | | | | secret.
link-4 | | | cluster-2 | | |
link-5 | | | cluster-2 | | |
Name | Remote Cluster | State | Error | Error Message
---------+----------------+-------------+----------------------+---------------------------------
link-1 | | | |
link-2 | | AVAILABLE | |
link-3 | | UNAVAILABLE | AUTHENTICATION_ERROR | Please check your API key and
| | | | secret.
link-4 | cluster-2 | | |
link-5 | cluster-2 | | |
6 changes: 0 additions & 6 deletions test/fixtures/output/kafka/link/list-link-yaml.golden
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
- link_name: link-1
source_cluster: cluster-1
destination_cluster: cluster-2
state: ""
- link_name: link-2
source_cluster: cluster-1
destination_cluster: cluster-2
state: AVAILABLE
- link_name: link-3
source_cluster: cluster-1
destination_cluster: cluster-2
state: UNAVAILABLE
error: AUTHENTICATION_ERROR
error_message: Please check your API key and secret.
Expand Down