Remove deprecated mqtrigger with kind fission (#2875)
* Remove deprecated mqtrigger with kind fission * Remove unused deps --------- Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -16,13 +16,7 @@ limitations under the License.
|
||||
|
||||
package validator
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
topicValidators = make(map[string]TopicValidator)
|
||||
lock = sync.Mutex{}
|
||||
kedaMqTypeValidators = map[string]bool{
|
||||
"kafka": true,
|
||||
"aws-sqs-queue": true,
|
||||
@@ -35,41 +29,13 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
type (
|
||||
TopicValidator func(topic string) bool
|
||||
)
|
||||
|
||||
func Register(mqType string, validator TopicValidator) {
|
||||
lock.Lock()
|
||||
defer lock.Unlock()
|
||||
|
||||
if validator == nil {
|
||||
panic("Nil message queue topic validator")
|
||||
}
|
||||
|
||||
_, registered := topicValidators[mqType]
|
||||
if registered {
|
||||
panic("Message queue topic validator already register")
|
||||
}
|
||||
|
||||
topicValidators[mqType] = validator
|
||||
}
|
||||
|
||||
func IsValidTopic(mqType, topic, mqtKind string) bool {
|
||||
if mqtKind == "keda" {
|
||||
return true
|
||||
}
|
||||
validator, registered := topicValidators[mqType]
|
||||
if !registered {
|
||||
return false
|
||||
}
|
||||
return validator(topic)
|
||||
func IsValidTopic(mqtKind string) bool {
|
||||
return mqtKind == "keda"
|
||||
}
|
||||
|
||||
func IsValidMessageQueue(mqType, mqtKind string) bool {
|
||||
if mqtKind == "keda" {
|
||||
return kedaMqTypeValidators[mqType]
|
||||
}
|
||||
_, registered := topicValidators[mqType]
|
||||
return registered
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user