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

Function augmentWebArg

commands/action.go:522–544  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, action *whisk.Action, augmentedAction *whisk.Action, existingAction *whisk.Action)

Source from the content-addressed store, hash-verified

520}
521
522func augmentWebArg(cmd *cobra.Command, args []string, action *whisk.Action, augmentedAction *whisk.Action, existingAction *whisk.Action) (*whisk.Action, error) {
523 var err error
524 preserveAnnotations := action.Annotations == nil
525
526 if cmd.LocalFlags().Changed(WEB_FLAG) {
527 augmentedAction.Annotations, err = webAction(Flags.action.web, action.Annotations, action.Name, preserveAnnotations, existingAction)
528 if existingAction != nil && err == nil {
529 // Always carry forward any existing --web-secure annotation value
530 // Although it can be overwritten later if --web-secure is set
531 webSecureAnnotations := getWebSecureAnnotations(existingAction)
532 if len(webSecureAnnotations) > 0 {
533 augmentedAction.Annotations = augmentedAction.Annotations.AppendKeyValueArr(webSecureAnnotations)
534 }
535 }
536 }
537
538 if err != nil {
539 return nil, err
540 }
541
542 whisk.Debug(whisk.DbgInfo, "augmentWebArg: Augmented action struct: %#v\n", augmentedAction)
543 return augmentedAction, nil
544}
545
546/*
547 * Return a whisk.Action augmented with --web-secure annotation updates

Callers 1

augmentActionFunction · 0.85

Calls 2

webActionFunction · 0.85
getWebSecureAnnotationsFunction · 0.85

Tested by

no test coverage detected