KGLOBAL-1755: Add link error fields to cluster linking list CLI operation#1435
KGLOBAL-1755: Add link error fields to cluster linking list CLI operation#1435Andrew Grant (andrewgrantcflt) merged 5 commits intomainfrom
Conversation
| LinkState string | ||
| LinkError string | ||
| LinkErrorMessage string |
There was a problem hiding this comment.
Let's add these fields to confluent kafka link describe too?
There was a problem hiding this comment.
The describe command actually maps to getting the link config i.e. adminClient.describeConfigs so we can't return this data for it.
There was a problem hiding this comment.
Oh, interesting. Maybe that should've been put in confluent kafka link configuration list.
There was a problem hiding this comment.
Yeah I'd probably agree. In fact confluent kafka link list ultimately calls adminClient.describeClusterLinks which is a bit confusing. We might want to do some refactoring at some point.
There was a problem hiding this comment.
This would be a breaking change, so I'll add a note about it to our confluent v3 wiki page.
There was a problem hiding this comment.
What's the breaking change here?
There was a problem hiding this comment.
Renaming confluent kafka link describe to confluent kafka link configuration list
There was a problem hiding this comment.
Yeah it would be. We aren't actively working on doing that as of now, just to clarify.
| ------------+-------------------+------------------------- | ||
| link-1 | cluster-1 | cluster-2 | ||
| link-2 | cluster-1 | cluster-2 | ||
| Link Name | Source Cluster Id | Destination Cluster Id | Link State | Link Error | Link Error Message |
There was a problem hiding this comment.
It seems redundant to be prefixing all of these new fields with "Link"... the user knows they're getting information on links since they ran confluent kafka link list to get this output. Why not call these "State", "Error", and "Error Message"?
There was a problem hiding this comment.
We're also running out of horizontal space 😄
There was a problem hiding this comment.
Agreed. Let me try and trim those names that start with Link
|
The Mac build is failing with: Brian Strauch (@brianstrauch) any chance you've seen this before? |
|
Per https://stackoverflow.com/questions/71507321/go-1-18-build-error-on-mac-unix-syscall-darwin-1-13-go253-golinkname-mus I'll try updating golang.org/x/sys |
| "github.com/spf13/cobra" | ||
| "strings" |
There was a problem hiding this comment.
Can you group these imports separately?
There was a problem hiding this comment.
Updated to:
import (
"strings"
kafkarestv3 "github.com/confluentinc/ccloud-sdk-go-v2/kafkarest/v3"
"github.com/spf13/cobra"
pcmd "github.com/confluentinc/cli/internal/pkg/cmd"
"github.com/confluentinc/cli/internal/pkg/errors"
"github.com/confluentinc/cli/internal/pkg/output"
)
| LinkState string | ||
| LinkError string | ||
| LinkErrorMessage string |
There was a problem hiding this comment.
Renaming confluent kafka link describe to confluent kafka link configuration list
| camelToSpacedListFields := camelToSpaced(listFields) | ||
| var humanLabels []string | ||
| for _, humanLabel := range camelToSpacedListFields { | ||
| humanLabels = append(humanLabels, strings.TrimPrefix(humanLabel, "Link ")) |
There was a problem hiding this comment.
We should remove the prefix in the JSON and YAML output too (and in the struct fields, so this edge case doesn't need to be hardcoded)
There was a problem hiding this comment.
Are programs supposed to consume the JSON and YAML output? I'm wondering if we should actually leave Link in tbh otherwise we become inconsistent with basically all the other APIs (REST, AdminClient, RPC).
For just the human readable part I understand wanting to remove the redundancy but if programs are supposed to parse the JSON and YAML I think I'd prefer to stay consistent with the other interfaces.
There was a problem hiding this comment.
+1 if this is how the fields are named in the API
JIRA
https://confluentinc.atlassian.net/browse/KGLOBAL-1755
Details
Updates the CLI to handle the new link error fields introduced. I tested running the CLI against a cluster in prod that doesnt have the REST changes to make sure it works against clusters without the new changes and thus is backwards compatible.
The cloud SDK was updated in confluentinc/ccloud-sdk-go-v2#53.
Testing
Ran
make testafter updating the golden filesChecklist
What
References
Test & Review