diff --git a/pkg/cmd/kafka/consumergroup/list/list.go b/pkg/cmd/kafka/consumergroup/list/list.go index 612aeba87..1ef85760e 100644 --- a/pkg/cmd/kafka/consumergroup/list/list.go +++ b/pkg/cmd/kafka/consumergroup/list/list.go @@ -13,7 +13,6 @@ import ( "github.com/redhat-developer/app-services-cli/pkg/cmd/flag" "github.com/redhat-developer/app-services-cli/pkg/cmdutil" flagutil "github.com/redhat-developer/app-services-cli/pkg/cmdutil/flags" - consumergrouputil "github.com/redhat-developer/app-services-cli/pkg/kafka/consumergroup" "github.com/redhat-developer/app-services-cli/pkg/connection" "github.com/redhat-developer/app-services-cli/pkg/dump" @@ -75,15 +74,6 @@ func NewListConsumerGroupCommand(f *factory.Factory) *cobra.Command { return fmt.Errorf(opts.localizer.MustLocalize("kafka.consumerGroup.common.error.noKafkaSelected")) } - if opts.search != "" { - validator := &consumergrouputil.Validator{ - Localizer: opts.localizer, - } - if err = validator.ValidateSearchInput(opts.search); err != nil { - return err - } - } - opts.kafkaID = cfg.Services.Kafka.ClusterID return runList(opts) diff --git a/pkg/kafka/consumergroup/validators.go b/pkg/kafka/consumergroup/validators.go deleted file mode 100644 index 27be67730..000000000 --- a/pkg/kafka/consumergroup/validators.go +++ /dev/null @@ -1,33 +0,0 @@ -package consumergroup - -import ( - "errors" - "regexp" - - "github.com/redhat-developer/app-services-cli/pkg/common/commonerr" - "github.com/redhat-developer/app-services-cli/pkg/localize" -) - -const ( - legalSearchChars = "^[a-zA-Z0-9-]+$" -) - -// Validator is a type for validating Kafka consumer group configuration values -type Validator struct { - Localizer localize.Localizer -} - -func (v *Validator) ValidateSearchInput(val interface{}) error { - search, ok := val.(string) - if !ok { - return commonerr.NewCastError(val, "string") - } - - matched, _ := regexp.Match(legalSearchChars, []byte(search)) - - if matched { - return nil - } - - return errors.New(v.Localizer.MustLocalize("kafka.consumerGroup.list.error.illegalSearchValue", localize.NewEntry("Search", search))) -} diff --git a/pkg/localize/locales/en/cmd/kafka_consumergroup_common.en.toml b/pkg/localize/locales/en/cmd/kafka_consumergroup_common.en.toml index bd2f738a6..e216b6cf7 100644 --- a/pkg/localize/locales/en/cmd/kafka_consumergroup_common.en.toml +++ b/pkg/localize/locales/en/cmd/kafka_consumergroup_common.en.toml @@ -31,8 +31,4 @@ one = 'no Kafka instance is currently selected, run "rhoas kafka use" to set the one = 'you are unauthorized to {{.Operation}} these consumer groups' [kafka.consumerGroup.list.error.forbidden] -one = 'you are forbidden to {{.Operation}} these consumer groups' - -[kafka.consumerGroup.list.error.illegalSearchValue] -description = 'Error message when invalid chars are used for search flag' -one = 'illegal search value "{{.Search}}"; only letters (Aa-Zz), numbers and "-" are accepted' \ No newline at end of file +one = 'you are forbidden to {{.Operation}} these consumer groups' \ No newline at end of file