Invoking Lambda Functions

HolaCloud Lambda supports direct admin calls, public calls, owner-scoped mux routes, and a small set of service inspection endpoints.

Admin Invocation

Use /api/v0/run/{lambda_id} when the client can send X-Glue-Authentication. The endpoint accepts any HTTP method.

1curl -X POST "https://api.hola.cloud/api/v0/run/YOUR_LAMBDA_ID" \
2  -H "X-Glue-Authentication: YOUR_TOKEN" \
3  -H "Content-Type: application/json" \
4  -d '{
5    "key": "value"
6  }'

Public Invocation

Use /run/{lambda_id} for webhooks, browser calls, and other clients that should not send admin credentials. The endpoint accepts any HTTP method.

1curl -X POST "https://api.hola.cloud/run/YOUR_LAMBDA_ID" \
2  -H "Content-Type: application/json" \
3  -d '{
4    "key": "value"
5  }'

The lambda receives request data through req, including the request method, path, headers, query values, and body.

Webhook Usage

Configure an external service to send events to:

1https://api.hola.cloud/run/YOUR_LAMBDA_ID

Example webhook handler:

1export default (req) => {
2  return {
3    body: {
4      received: true,
5      event: req.headers["x-github-event"],
6      payload: req.body
7    }
8  };
9};

Mux Router

The mux router forwards owner-scoped routes through /mux/{owner_id}/*. It accepts any HTTP method.

1curl -X GET "https://api.hola.cloud/mux/OWNER_ID/any/path/here"

The owner_id identifies the HolaCloud owner. The remaining path is forwarded to the lambda routing logic.

Ongoing Invocations

Check currently running invocations:

1curl "https://api.hola.cloud/ongoing"

Current User

The /me endpoint returns information for the authenticated user:

1curl "https://api.hola.cloud/me" \
2  -H "X-Glue-Authentication: YOUR_TOKEN"

OpenAPI Specification

HolaCloud exposes the Lambda OpenAPI document at:

1GET https://api.hola.cloud/openapi

Comments

Leave a comment