You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/09/15 03:32:45 UTC

[GitHub] daisy-ycguo opened a new issue #492: Review effects of two "inputs" formats

daisy-ycguo opened a new issue #492: Review effects of two "inputs" formats
URL: https://github.com/apache/incubator-openwhisk-wskdeploy/issues/492
 
 
   According the samples in specification, we support two formats for "inputs" (list of
   parameter):
   a complex one:
   ```
     actions:
       func1:
         function: actions/function.js
         runtime: nodejs:6
         inputs:
           functionID:
             type: string
             description: the ID of function
           visited:
             type: string
             description: the visted city list
   ```
   and a simple one:
   ```
   package:
     name: TestSequencesCreation
     actions:
       func1:
         function: actions/function.js
         runtime: nodejs:6
         inputs:
           functionID: string
           visited: string
   ```
   The complex one will create an action, with empty string `""` to be the default values of parameters. The simple one will create an action with `string` to be the default values of parameters. See below samples.
   action created by complex format
   ```
   {
       "namespace": "guoyingc@cn.ibm.com_dev/TestSequencesCreation",
       "name": "func1",
       "version": "0.0.1",
       "exec": {
           "kind": "nodejs:6",
           "code": "/**\n * Return a simple string to \n * confirm this function has been visited.\n *\n * @param visited the visited function list\n */\nfunction main(params) {\n    functionID = params.functionID || 'X'\n    if (params.visited == null) {\n        params.visited = 'function'+functionID;\n    } else {\n        params.visited = params.visited + ', function'+functionID;\n    }\n    return {\"visited\":params.visited};\n}\n"
       },
       "annotations": [
           {
               "key": "exec",
               "value": "nodejs:6"
           }
       ],
       "parameters": [
           {
               "key": "functionID",
               "value": ""
           },
           {
               "key": "visited",
               "value": ""
           }
       ],
       "limits": {
           "timeout": 60000,
           "memory": 256,
           "logs": 10
       },
       "publish": false
   }
   ```
   action created by the simple format:
   ```
   ok: got action TestSequencesCreation/func1
   {
       "namespace": "guoyingc@cn.ibm.com_dev/TestSequencesCreation",
       "name": "func1",
       "version": "0.0.1",
       "exec": {
           "kind": "nodejs:6",
           "code": "/**\n * Return a simple string to \n * confirm this function has been visited.\n *\n * @param visited the visited function list\n */\nfunction main(params) {\n    functionID = params.functionID || 'X'\n    if (params.visited == null) {\n        params.visited = 'function'+functionID;\n    } else {\n        params.visited = params.visited + ', function'+functionID;\n    }\n    return {\"visited\":params.visited};\n}\n"
       },
       "annotations": [
           {
               "key": "exec",
               "value": "nodejs:6"
           }
       ],
       "parameters": [
           {
               "key": "functionID",
               "value": "string"
           },
           {
               "key": "visited",
               "value": "string"
           }
       ],
       "limits": {
           "timeout": 60000,
           "memory": 256,
           "logs": 10
       },
       "publish": false
   }
   ```
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services