Skip to main content

Module openwhisk

Module openwhisk 

Source
Expand description

Apache OpenWhisk serverless-upstream plugin (openwhisk).

Port of APISIX’s openwhisk plugin (3.17). Invokes an OpenWhisk action (blocking, with the result inlined) and returns the action’s reply as the gateway response — it replaces the upstream, so the node’s success port should be wired straight to client.in.

The request body is POSTed as the action parameters to <api_host>/api/v1/namespaces/<namespace>/actions/<package/><action>?blocking=true&result=<result>&timeout=<ms> with an Authorization: Basic <base64(service_token)> header.

api_host, namespace, package, and action support {{namespace.path}} references (plain render, no legacy $var interpolation) — the endpoint is rebuilt per request so a value like {{request.headers.x-tenant}} in namespace routes each request to a different OpenWhisk namespace. authorization (built from service_token) is never templated — it is a credential, not an endpoint field. namespace/package/action are percent-encoded at render time before insertion into the URL path (see encode_path_segment); api_host is not encoded (see its field doc).

§Response mapping

OpenWhisk returns a JSON envelope. An action may return just a body, or set statusCode and headers explicitly. map_response mirrors APISIX: statusCode (when present) becomes the response status, headers are applied, and body (or the raw envelope when absent) becomes the body. A non-JSON envelope fails the node with 503 through the error port.

Structs§

MappedResponse 🔒
The status, headers, and body mapped out of an OpenWhisk envelope.
OpenWhiskPlugin
Invokes an OpenWhisk action and maps its reply into Context.response.

Functions§

encode_path_segment 🔒
Percent-encodes s for safe insertion as a single URL path segment.
map_response 🔒
Maps an OpenWhisk activation reply into a (status, headers, body) triple.
reject 🔒
Builds the OPENWHISK_CALLOUT_ERROR rejection carrying the context.