openwhisk
Invokes an Apache OpenWhisk action as the upstream.
openwhiskPriority -1901What it does
openwhisk answers the requests on a route by running an action on Apache OpenWhisk instead of calling an upstream. The gateway calls the platform at API host with the namespace key under Service token. It runs the Action of the Namespace, inside the Package when one is named.
When to use it
- An order checkout written as an action,
create-orderin thecheckoutpackage, published as one path of the orders API. - A team that already runs its handlers on OpenWhisk and wants to offer one of them to partners over HTTP.
- One path of an API answered by an action while the rest stays on your own backend instances.
Not for a backend of your own — see Upstream (Upstreams are the backends that routes and services send traffic to), a function on OpenFunction — see openfunction (Invokes an OpenFunction function as the upstream) or code that runs inside the gateway itself — see serverless-pre-function (Runs Lua functions before the other plugins of a phase).
Set it up
Answer each request by running an action on OpenWhisk
The service token is the namespace key in the form user:password; the gateway sends it base64-encoded as the Basic credential.
Under Basics set API host to https://openwhisk.example.com, set Service token to <secret>, set Namespace to orders, set Action to create-order and set Package to checkout.
{
"api_host": "https://openwhisk.example.com",
"service_token": "<secret>",
"namespace": "orders",
"package": "checkout",
"action": "create-order"
}
Things to know
- Namespace — A Namespace that carries a space is refused when you save, and so is a Package or an Action that does.
- API host — An empty API host is refused when you save.
- AdviceGive the gateway a namespace key of its own, used by no person, so that it can be withdrawn without touching anyone else's access.
Settings
The fields as the console shows them, section by section.
Basics
api_hoststringRequiredservice_tokenstringRequiredThe namespace key, written as user:password and sent base64-encoded as the Basic credential. Stored on the engine and shown only to roles that manage this object.
namespacestringRequiredpattern
^([\w]|[\w][\w@.-]*[\w@.-]+)$actionstringRequiredpattern
^([\w]|[\w][\w@.-]*[\w@.-]+)$packagestringLeft empty, the action is looked for directly under the namespace.
pattern
^([\w]|[\w][\w@.-]*[\w@.-]+)$Behavior
resultbooleandefault truetimeoutintegerdefault 3000The same number is sent to the platform as the activation timeout.
ssl_verifybooleandefault trueAdvanced
max_req_body_sizeintegerdefault 67108864The largest request body, in bytes, that is buffered in memory and forwarded. A larger body is rejected.
keepalivebooleandefault truekeepalive_poolintegerdefault 5keepalive_timeoutintegerdefault 60000