Managing Lambda Functions
After creating a lambda, use the management API to inspect it, update its supported fields, list all lambdas in the account, or delete it.
Function Structure
JavaScript lambdas export a default handler. The handler receives a request object and returns the response body you want HolaCloud to send back.
1export default (req) => {
2 return {
3 body: {
4 method: req.method,
5 path: req.path,
6 headers: req.headers,
7 data: req.body
8 }
9 };
10};
Static lambdas use one of the static language modes: static-html, static-css, or static-js. In those modes, code is the content served for the matching lambda.
Updating a Lambda
Use PATCH /api/v0/lambdas/{lambda_id} to update name, language, code, method, or path.
1curl -X PATCH "https://api.hola.cloud/api/v0/lambdas/YOUR_LAMBDA_ID" \
2 -H "X-Glue-Authentication: YOUR_TOKEN" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "name": "hello-updated",
6 "method": "POST",
7 "path": "/hello-updated",
8 "code": "export default (req) => ({ body: { message: \"Updated lambda\", data: req.body } })"
9 }'
Expected response:
1{
2 "id": "f3b2c1a0-1234-5678-9abc-def012345678",
3 "created_timestamp": 1750507200,
4 "owner": "user_123",
5 "project_id": "project_456",
6 "name": "hello-updated",
7 "language": "javascript",
8 "code": "export default (req) => ({ body: { message: \"Updated lambda\", data: req.body } })",
9 "method": "POST",
10 "path": "/hello-updated"
11}
Viewing Lambda Details
Retrieve one lambda by ID:
1curl "https://api.hola.cloud/api/v0/lambdas/YOUR_LAMBDA_ID" \
2 -H "X-Glue-Authentication: YOUR_TOKEN"
Listing All Lambdas
1curl "https://api.hola.cloud/api/v0/lambdas" \
2 -H "X-Glue-Authentication: YOUR_TOKEN"
Deleting a Lambda
Permanently remove a lambda:
1curl -X DELETE "https://api.hola.cloud/api/v0/lambdas/YOUR_LAMBDA_ID" \
2 -H "X-Glue-Authentication: YOUR_TOKEN"
A successful deletion returns the API response for the deleted lambda or a confirmation payload, depending on the deployed API version.
Comments