Triggers and Rules

Triggers

The Trigger entity schema contains the necessary information to describe the stream of events that it represents. For more information, see the document “Creating Triggers and Rules”.

Fields

Requirements

The Trigger name (i.e., MUST be less than or equal to 256 characters.

The Trigger entity schema includes all general Entity Schema fields in addition to any fields declared above.

Notes

  • The ‘events’ key name is not supported at this time.
  • The Trigger entity within the OpenWhisk programming model is considered outside the scope of the Package (although there are discussions about changing this in the future). This means that Trigger and API information will not be returned when using the OpenWhisk Package API:
    • $ wsk package list <package name>
  • However, it may be obtained using the Trigger API:

Grammar

<triggerName>:
  <Entity schema>
  feed: <feed name>
  credential: <Credential>
  inputs:
    <list of parameter>

Example

triggers:
  everyhour:
    feed: /whisk.system/alarms/alarm

Rules

The Rule entity schema contains the information necessary to associates one trigger with one action, with every firing of the trigger causing the corresponding action to be invoked with the trigger event as input. For more information, see the document “Creating Triggers and Rules”.

Fields

Requirements

  • The Rule name (i.e., ) MUST be less than or equal to 256 characters.
  • The Rule entity schema includes all general Entity Schem fields in addition to any fields declared above.

Notes

  • OpenWhisk only supports a value of ‘true’ for the ‘rule’ key's value at this time.

Grammar

<ruleName>:
  description: <string>
  trigger: <string>
  action: <string>
  rule: <regex>

Example

my_rule:
  description: Enable events for my Action
  trigger: my_trigger
  action: my_action