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

Function getParamUnion

commands/util.go:430–449  ·  view source on GitHub ↗

getParamUnion(keyValArrAnnots, keyValArrParams, key) returns the union of parameters listed under annotations (keyValArrAnnots, using key) and bound parameters (keyValArrParams). Bound parameters will be denoted with a prefixed "*", and finalized bound parameters (can't be changed by user) will be d

(keyValArrAnnots whisk.KeyValueArr, keyValArrParams whisk.KeyValueArr, key string)

Source from the content-addressed store, hash-verified

428// a prefixed "*", and finalized bound parameters (can't be changed by
429// user) will be denoted by a prefixed "**".
430func getParamUnion(keyValArrAnnots whisk.KeyValueArr, keyValArrParams whisk.KeyValueArr, key string) []string {
431 var res []string
432 tag := "*"
433 if getValueBool(keyValArrAnnots, "final") {
434 tag = "**"
435 }
436 boundParams := getKeys(keyValArrParams)
437 annotatedParams := getChildValueStrings(keyValArrAnnots, "parameters", key)
438 res = append(boundParams, annotatedParams...) // Create union of boundParams and annotatedParams with duplication
439 for i := 0; i < len(res); i++ {
440 for j := i + 1; j < len(res); j++ {
441 if res[i] == res[j] {
442 res = append(res[:j], res[j+1:]...) // Remove duplicate entry
443 }
444 }
445 }
446 sort.Strings(res)
447 res = tagBoundParams(boundParams, res, tag)
448 return res
449}
450
451// tagBoundParams(boundParams, paramUnion, tag) returns the list paramUnion with
452// all strings listed under boundParams set with a prefix tag.

Callers 3

printPackageSummaryFunction · 0.85
printActionSummaryFunction · 0.85
printTriggerSummaryFunction · 0.85

Calls 4

getValueBoolFunction · 0.85
getKeysFunction · 0.85
getChildValueStringsFunction · 0.85
tagBoundParamsFunction · 0.85

Tested by

no test coverage detected