MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / createOrUpdate

Function createOrUpdate

commands/trigger.go:80–97  ·  view source on GitHub ↗

** * Create or update a trigger. * * NOTE: this function will exit in case of a processing error since it indicates a problem parsing parameters. */

(Client *whisk.Client, fqn *QualifiedName, trigger *whisk.Trigger, overwrite bool)

Source from the content-addressed store, hash-verified

78 * NOTE: this function will exit in case of a processing error since it indicates a problem parsing parameters.
79 */
80func createOrUpdate(Client *whisk.Client, fqn *QualifiedName, trigger *whisk.Trigger, overwrite bool) {
81 // TODO get rid of these global modifiers
82 Client.Namespace = fqn.GetNamespace()
83 _, _, err := Client.Triggers.Insert(trigger, overwrite)
84
85 if err != nil {
86 whisk.Debug(whisk.DbgError, "Client.Triggers.Insert(%+v, %t) failed: %s\n", trigger, overwrite, err)
87 var errStr string
88 if !overwrite {
89 errStr = wski18n.T("Unable to create trigger '{{.name}}': {{.err}}",
90 map[string]interface{}{"name": trigger.Name, "err": err})
91 } else {
92 errStr = wski18n.T("Unable to update trigger '{{.name}}': {{.err}}",
93 map[string]interface{}{"name": trigger.Name, "err": err})
94 }
95 ExitOnError(whisk.MakeWskErrorFromWskError(errors.New(errStr), err, whisk.EXIT_CODE_ERR_GENERAL, whisk.DISPLAY_MSG, whisk.NO_DISPLAY_USAGE))
96 }
97}
98
99var triggerFireCmd = &cobra.Command{
100 Use: "fire TRIGGER_NAME [PAYLOAD]",

Callers 2

CreateMethod · 0.85
CreateExtendedVersionFunction · 0.85

Calls 3

ExitOnErrorFunction · 0.85
GetNamespaceMethod · 0.80
InsertMethod · 0.80

Tested by

no test coverage detected