steven0711dong commented on a change in pull request #479: Trigger parameter
issue
URL: https://github.com/apache/openwhisk-cli/pull/479#discussion_r376517816
##########
File path: commands/trigger.go
##########
@@ -436,47 +440,118 @@ func (t *Trigger) Create(Client *whisk.Client, args
[]string) error {
return NewQualifiedNameError(args[0], err)
}
- paramArray := Flags.common.param
annotationArray := Flags.common.annotation
- feedParam := Flags.common.feed
authToken := Client.Config.AuthToken
// if a feed is specified, create additional parameters which must be
passed to the feed
- feedName, feedParams := feedParameters(feedParam, FEED_CREATE,
triggerName, authToken)
- // the feed receives all the parameters that are specified on the
command line so we merge
- // the feed lifecycle parameters with the command line ones
- parameters := getParameters(append(paramArray, feedParams...), feedName
== nil, false)
+ feedQualifiedName, additionalFeedParams :=
feedParameters(Flags.common.feed, FEED_CREATE, triggerName, authToken)
// if a feed is specified, add feed annotation the annotations declared
on the command line
// TODO: add test to ensure that generated annotation has precedence
- if feedName != nil {
- annotationArray = append(annotationArray,
getFormattedJSON("feed", feedName.GetFullQualifiedName()))
+ if feedQualifiedName != nil {
+ annotationArray = append(annotationArray,
getFormattedJSON("feed", feedQualifiedName.GetFullQualifiedName()))
}
annotations := getParameters(annotationArray, true, true)
+ //simplestTrigger indicates user are creating a trigger without any
feed or parameters
Review comment:
I created two functions so that both create and update could use. Some other
variables such as params, feed params do exist in both functions but are
created differently and the creation depends on users' intention on how to
issue trigger command(old way and new way). So it might make things more
complicated to create functions out of duplicate code.
I have to admit that after adding the new flags, both functions become
bigger but I think it might be a good idea to separate execution path for the
old way of creating trigger from the new way so they do not get lumped
together.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services