Skip to content
Open
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
7 changes: 2 additions & 5 deletions internal/kafka/command_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,8 @@ func (c *command) validateTopic(client *ckgo.AdminClient, topic string, cluster
}
}
if !foundTopic {
log.CliLogger.Trace("validateTopic failed due to topic not being found in the client's topic list")
return errors.NewErrorWithSuggestions(
fmt.Sprintf(errors.TopicDoesNotExistOrMissingPermissionsErrorMsg, topic),
fmt.Sprintf(errors.TopicDoesNotExistOrMissingPermissionsSuggestions, cluster.ID),
)
log.CliLogger.Tracef("validateTopic: Topic '%s' not visible in metadata, this could be due to ACL restrictions. Proceeding with operation to allow Kafka to handle authorization.", topic)
return nil
}

log.CliLogger.Tracef("validateTopic succeeded")
Expand Down
8 changes: 2 additions & 6 deletions internal/kafka/command_topic_onprem.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (

ckgo "github.com/confluentinc/confluent-kafka-go/v2/kafka"

"github.com/confluentinc/cli/v4/pkg/errors"
"github.com/confluentinc/cli/v4/pkg/log"
)

Expand All @@ -26,11 +25,8 @@ func ValidateTopic(adminClient *ckgo.AdminClient, topic string) error {
}
}
if !foundTopic {
log.CliLogger.Tracef("validateTopic failed due to topic not being found in the client's topic list")
return errors.NewErrorWithSuggestions(
fmt.Sprintf(errors.TopicDoesNotExistOrMissingPermissionsErrorMsg, topic),
fmt.Sprintf(errors.TopicDoesNotExistOrMissingPermissionsSuggestions, "<cluster-id>"),
)
log.CliLogger.Tracef("validateTopic: Topic '%s' not visible in metadata, this could be due to ACL restrictions. Proceeding with operation to allow Kafka to handle authorization.", topic)
return nil
}

log.CliLogger.Tracef("validateTopic succeeded")
Expand Down
8 changes: 3 additions & 5 deletions pkg/errors/error_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ const (
RequiredFlagNotSetErrorMsg = "required flag `--%s` not set"

// kafka cluster commands
CkuMoreThanZeroErrorMsg = "`--cku` value must be greater than 0"
TopicDoesNotExistOrMissingPermissionsErrorMsg = `topic "%s" does not exist or user does not have the ACLs or role bindings required to describe it`
TopicDoesNotExistOrMissingPermissionsSuggestions = "To list topics for Kafka cluster \"%[1]s\", use `confluent kafka topic list --cluster %[1]s`.\nTo list ACLs use `confluent kafka acl list --cluster %[1]s`.\nTo list role bindings use `confluent iam rbac role-binding list`."
KafkaClusterNotFoundErrorMsg = `Kafka cluster "%s" not found`
ChooseRightEnvironmentSuggestions = "Ensure the cluster ID you entered is valid.\n" +
CkuMoreThanZeroErrorMsg = "`--cku` value must be greater than 0"
KafkaClusterNotFoundErrorMsg = `Kafka cluster "%s" not found`
ChooseRightEnvironmentSuggestions = "Ensure the cluster ID you entered is valid.\n" +
"Ensure the cluster you are specifying belongs to the currently selected environment with `confluent kafka cluster list`, `confluent environment list`, and `confluent environment use`."
UnknownTopicErrorMsg = `unknown topic "%s"`
KafkaClusterMissingPrefixErrorMsg = `Kafka cluster "%s" is missing required prefix "lkc-"`
Expand Down