Chapter 3. The OpenWhisk CLI and JavaScript API
OpenWhisk applications are made up of entities you can manipulate with the command line or programmatically. The CLI uses the command wsk
, which can be used interactively or by writing automated scripts. You can also use JavaScript, using an API crafted explicitly for OpenWhisk. These are both external interfaces to the REST API OpenWhisk exposes. Since they are two different aspects of the same thing, they are both covered in this chapter.
Before we get into design patterns in the next few chapters, first you need to learn about the OpenWhisk API. This API is critical to writing applications that leverage specific OpenWhisk features.
We already covered the fundamentals of OpenWhisk in the example in Chapter 2, but let’s recap a few things here:
-
Packages are used to group actions together, share parameters, and annotations, etc., and they also provide a base URL that can be used by web applications.
-
Actions are the building blocks of an OpenWhisk application, and can be written in one of the programming languages supported by OpenWhisk; they receive input and provide an output, both in JSON format.
-
Actions can be interconnected, where the output of one action becomes the input of another, thus creating a sequence.
-
Triggers are similar to actions but are used through rules to activate multiple actions.
-
Rules associate triggers with actions, so when you fire a trigger, all its actions are invoked.
-
Feeds are specially crafted ...
Get Learning Apache OpenWhisk now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.