diff --git a/internal/kafka/command_link_describe.go b/internal/kafka/command_link_describe.go index 6b8d0eeac0..e17180d18d 100644 --- a/internal/kafka/command_link_describe.go +++ b/internal/kafka/command_link_describe.go @@ -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() } diff --git a/internal/kafka/command_link_list.go b/internal/kafka/command_link_list.go index a363b32fc1..00e7fdb6ba 100644 --- a/internal/kafka/command_link_list.go +++ b/internal/kafka/command_link_list.go @@ -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") + } } diff --git a/test/fixtures/output/kafka/link/list-link-json.golden b/test/fixtures/output/kafka/link/list-link-json.golden index 29dd6a5e11..bdcf61efce 100644 --- a/test/fixtures/output/kafka/link/list-link-json.golden +++ b/test/fixtures/output/kafka/link/list-link-json.golden @@ -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." diff --git a/test/fixtures/output/kafka/link/list-link-plain.golden b/test/fixtures/output/kafka/link/list-link-plain.golden index 8dbc384ffb..e518a9c29b 100644 --- a/test/fixtures/output/kafka/link/list-link-plain.golden +++ b/test/fixtures/output/kafka/link/list-link-plain.golden @@ -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 | | | diff --git a/test/fixtures/output/kafka/link/list-link-yaml.golden b/test/fixtures/output/kafka/link/list-link-yaml.golden index 583519cafa..16d5bf56c3 100644 --- a/test/fixtures/output/kafka/link/list-link-yaml.golden +++ b/test/fixtures/output/kafka/link/list-link-yaml.golden @@ -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.