Actions

The Action entity schema contains the necessary information to deploy an OpenWhisk function and define its deployment configurations, inputs and outputs.

Fields

Requirements

  • The Action name (i.e., <actionName> MUST be less than or equal to 256 characters.
  • The Action entity schema includes all general Entity Schema fields in addition to any fields declared above.
  • Supplying a runtime name without a version indicates that OpenWhisk SHOULD use the most current version.
  • Supplying a runtime major version without a minor version (et al.) indicates OpenWhisk SHOULD use the most current minor version.
  • Unrecognized limit keys (and their values) SHALL be ignored.
  • Invalid values for known limit keys SHALL result in an error.
  • If the Feed is a Feed Action (i.e., the feed key's value is set to true), it MUST support the following parameters:
    • lifecycleEvent: one of ‘CREATE’, ‘DELETE’, ‘PAUSE’,or ‘UNPAUSE’. These operation names MAY be supplied in lowercase (i.e., ‘create’, ‘delete’, ‘pause’, etc.).
    • triggerName: the fully-qualified name of the trigger which contains events produced from this feed.
    • authKey: the Basic auth. credentials of the OpenWhisk user who owns the trigger.

Notes

  • Input and output parameters are implemented as JSON Objects within the OpenWhisk framework.
  • The maximum code size for an Action currently must be less than 48 MB.
  • The maximum payload size for an Action (i.e., POST content length or size) currently must be less than 1 MB.
  • The maximum parameter size for an Action currently must be less than 1 MB.
  • if no value for runtime is supplied, the value ‘language:default’ will be assumed.

Grammar

<actionName>[.<type>]:
  <Entity schema>
  version: <version>
  function: <string>
  runtime: <name>[@<[range of ]version>]
  inputs:
    <list of parameter>
  outputs:
    <list of parameter>
  limits:
    <list of limit key-values>
  feed: <boolean> # default: false
  web-export: <boolean>

Note: the optional [.] grammar is used for naming Web Actions.

Example

my_awesome_action:
  version: 1.0
  description: An awesome action written for node.js
  function: src/js/action.js
  runtime: nodejs@>0.12<6.0
  inputs:
    not_awesome_input_value:
      description: Some input string that is boring
      type: string
  outputs:
    awesome_output_value:
      description: Impressive output string
      type: string
  limits:
    memorySize: 512 kB
    logSize: 5 MB

Valid Runtime names

The following runtime values are currently supported by the OpenWhisk platform.

Each of these runtimes also include additional built-in packages (or libraries) that have been determined be useful for Actions surveyed and tested by the OpenWhisk platform.

These packages may vary by OpenWhisk release; examples of supported runtimes as of this specification version include:

Notes

  • If no value for runtime is supplied, the value ‘language:default’ will be assumed.

Recognized File extensions

Although it is best practice to provide a runtime value when declaring an Action, it is not required. In those cases, that a runtime is not provided, the package tooling will attempt to derive the correct runtime based upon the the file extension for the Action's function (source code file). The following file extensions are recognized and will be run on the latest version of corresponding Runtime listed below:

Valid Limit keys

Notes

  • The default values and ranges for limit configurations reflect the defaults for the OpenWhisk platform (open source code).  These values may be changed over time to reflect the open source community consensus.

Web Actions

OpenWhisk can turn any Action into a ‘web action’ causing it to return HTTP content without use of an API Gateway. Simply supply a supported ‘type’ extension to indicate which content type is to be returned and identified in the HTTP header (e.g., .json, .html, .text or .http).

Return values from the Action's function are used to construct the HTTP response. The following response parameters are supported in the response object.

  • headers: a JSON object where the keys are header-names and the values are string values for those headers (default is no headers).
  • code: a valid HTTP status code (default is 200 OK).
  • body: a string which is either plain text or a base64 encoded string (for binary data).