Lambda
核心功能
通过 Lambda API 创建、更新、列出、删除并调用 HTTP 函数。
JavaScript 函数
使用内置运行时 helper,例如 write、body、query 和 headers。
HTTP 调用
通过公共运行 URL、认证的管理运行 URL,或按 owner/project 的 mux 路由调用函数。
静态响应
用同一套 Lambda 模型提供静态 HTML、CSS 和 JavaScript 片段。
Quick start
快速开始
使用 API 在几秒内开始使用 Lambda。
curl -X POST https://api.hola.cloud/api/v0/lambdas \
-H 'X-Glue-Authentication: {"user":{"id":"user-123"}}' \
-d '{"name":"hello","language":"javascript","method":"GET","path":"/hello","code":"write(\"Hello from Lambda\")"}'POST /api/v0/lambdas HTTP/1.1
Host: api.hola.cloud
X-Glue-Authentication: {"user":{"id":"user-123"}}
{"name":"hello","language":"javascript","method":"GET","path":"/hello","code":"write(\"Hello from Lambda\")"}package main
import (
"fmt"
"io"
"net/http"
"encoding/json"
"strings"
)
func main() {
payload := map[string]any{"code": "write(\"Hello from Lambda\")", "language": "javascript", "method": "GET", "name": "hello", "path": "/hello"}
bodyBytes, err := json.Marshal(payload)
if err != nil {
panic(err)
}
body := string(bodyBytes)
req, err := http.NewRequest("POST", "https://api.hola.cloud/api/v0/lambdas", strings.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("X-Glue-Authentication", "{\"user\":{\"id\":\"user-123\"}}")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$payload = ['code' => 'write("Hello from Lambda")', 'language' => 'javascript', 'method' => 'GET', 'name' => 'hello', 'path' => '/hello'];
$body = json_encode($payload);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/api/v0/lambdas',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => [
'X-Glue-Authentication: {"user":{"id":"user-123"}}',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
import json
headers = {
"X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}",
}
payload = {"code": "write(\"Hello from Lambda\")", "language": "javascript", "method": "GET", "name": "hello", "path": "/hello"}
body = json.dumps(payload)
response = requests.request(
"POST",
"https://api.hola.cloud/api/v0/lambdas",
headers=headers,
data=body
)
print(response.text)
const payload = {"code": "write(\"Hello from Lambda\")", "language": "javascript", "method": "GET", "name": "hello", "path": "/hello"};
const response = await fetch("https://api.hola.cloud/api/v0/lambdas", {
method: "POST",
headers: {
"X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}"
},
body: JSON.stringify(payload)
});
console.log(await response.text());
const payload = {"code": "write(\"Hello from Lambda\")", "language": "javascript", "method": "GET", "name": "hello", "path": "/hello"};
const response = await fetch("https://api.hola.cloud/api/v0/lambdas", {
method: "POST",
headers: {
"X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}"
},
body: JSON.stringify(payload)
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Map;
import java.util.List;
public class Main {
public static void main(String[] args) throws Exception {
var payload = Map.of("code", "write(\"Hello from Lambda\")", "language", "javascript", "method", "GET", "name", "hello", "path", "/hello");
var body = new ObjectMapper().writeValueAsString(payload);
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/api/v0/lambdas"))
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.header("X-Glue-Authentication", "{\"user\":{\"id\":\"user-123\"}}")
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Use cases
常见用例
微服务编排
Build and deploy with Lambda on HolaCloud's enterprise platform, designed for security, reliability, and scale.
数据管道自动化
Build and deploy with Lambda on HolaCloud's enterprise platform, designed for security, reliability, and scale.
事件驱动架构
Build and deploy with Lambda on HolaCloud's enterprise platform, designed for security, reliability, and scale.
后端 API 开发
Build and deploy with Lambda on HolaCloud's enterprise platform, designed for security, reliability, and scale.
评论