Removed code related to mqtrigger (#1680)

This commit is contained in:
Rahul Bhati
2020-08-06 20:59:08 +05:30
committed by GitHub
parent 587b166a4e
commit f751546913
9 changed files with 23 additions and 533 deletions
+6 -6
View File
@@ -59,8 +59,10 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
fnName := input.String(flagkey.MqtFnName)
fnNamespace := input.String(flagkey.NamespaceFunction)
mqtKind := input.String(flagkey.MqtKind)
mqType := (fv1.MessageQueueType)(input.String(flagkey.MqtMQType))
if !validator.IsValidMessageQueue((string)(mqType)) {
if !validator.IsValidMessageQueue((string)(mqType), mqtKind) {
return errors.New("Unsupported message queue type")
}
@@ -88,7 +90,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
contentType = "application/json"
}
err := checkMQTopicAvailability(mqType, topic, respTopic)
err := checkMQTopicAvailability(mqType, mqtKind, topic, respTopic)
if err != nil {
return err
}
@@ -119,8 +121,6 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
secret := input.String(flagkey.MqtSecret)
mqtKind := input.String(flagkey.MqtKind)
if input.Bool(flagkey.SpecSave) {
specDir := util.GetSpecDir(input)
fr, err := spec.ReadSpecs(specDir)
@@ -197,9 +197,9 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
return nil
}
func checkMQTopicAvailability(mqType fv1.MessageQueueType, topics ...string) error {
func checkMQTopicAvailability(mqType fv1.MessageQueueType, mqtKind string, topics ...string) error {
for _, t := range topics {
if len(t) > 0 && !validator.IsValidTopic((string)(mqType), t) {
if len(t) > 0 && !validator.IsValidTopic((string)(mqType), t, mqtKind) {
return errors.Errorf("invalid topic for %s: %s", mqType, t)
}
}