Added validation to keda types and updated help (#2346)

* Added validation to keda types and updated help

* Changed formatting of help

* Changed variable name
This commit is contained in:
Ankit Chawla
2022-02-09 19:55:14 +05:30
committed by GitHub
parent e1fb5a7411
commit 8ee74161fc
2 changed files with 14 additions and 5 deletions
+12 -3
View File
@@ -21,8 +21,17 @@ import (
)
var (
topicValidators = make(map[string]TopicValidator)
lock = sync.Mutex{}
topicValidators = make(map[string]TopicValidator)
lock = sync.Mutex{}
kedaMqTypeValidators = map[string]bool{
"kafka": true,
"aws-sqs-queue": true,
"aws-kinesis-stream": true,
"gcp-pubsub": true,
"stan": true,
"rabbitmq": true,
"redis": true,
}
)
type (
@@ -58,7 +67,7 @@ func IsValidTopic(mqType, topic, mqtKind string) bool {
func IsValidMessageQueue(mqType, mqtKind string) bool {
if mqtKind == "keda" {
return true
return kedaMqTypeValidators[mqType]
}
_, registered := topicValidators[mqType]
return registered