Actions
May 9, 2018 · View on GitHub
Adding fixed input values to an Action
This example builds upon the previous “hello world” example and shows how fixed values can be supplied to the input parameters of an Action.
It shows how to:
- declare input parameters on the action ‘
hello_world’ using a single-line grammar. - add ‘
name’ and ‘place’ as input parameters with the fixed values “Sam” and “the Shire” respectively.
Manifest File
Example: “Hello world” with fixed input values for ‘name’ and ‘place’
packages:
hello_world_package:
version: 1.0
license: Apache-2.0
actions:
hello_world_fixed_parms:
function: src/hello.js
inputs:
name: Sam
place: the Shire
Deploying
$ wskdeploy -m docs/examples/manifest_hello_world_fixed_parms.yaml
Invoking
$ wsk action invoke hello_world_package/hello_world_fixed_parms --blocking
Result
The invocation should return an 'ok' with a response that includes this result:
"result": {
"greeting": "Hello, Sam from the Shire"
},
Discussion
In this example:
- The value for the ‘
name’ input parameter would be set to “Sam”. - The value for the ‘
place’ input parameter would be set to “the Shire”. - The wskdeploy utility would infer that both ‘
name’ and ‘place’ input parameters to be of type ‘string’.
Source code
The manifest file for this example can be found here:
Specification
For convenience, the Actions and Parameters grammar can be found here: