修改 Lambda
更新现有 lambda 的支持字段。
认证
需要 X-Glue-Authentication。
Path 参数
| 参数 |
类型 |
描述 |
lambda_id |
string |
Lambda 标识符 |
请求体
| 字段 |
类型 |
描述 |
name |
string |
新的 lambda 名称 |
language |
string |
javascript、static-html、static-css 或 static-js |
code |
string |
新源码或静态内容 |
method |
string |
新 HTTP 方法 |
path |
string |
新 HTTP path |
HTTP 请求
1PATCH /api/v0/lambdas/f1a2b3c4-d5e6-7890-abcd-ef0123456789 HTTP/1.1
2Host: api.hola.cloud
3X-Glue-Authentication: YOUR_TOKEN
4Content-Type: application/json
5
6{
7 "name": "hello-updated",
8 "method": "POST",
9 "path": "/hello-updated",
10 "code": "export default (req) => ({ body: { message: 'Updated lambda', data: req.body } })"
11}
示例
1curl -X PATCH "https://api.hola.cloud/api/v0/lambdas/f1a2b3c4-d5e6-7890-abcd-ef0123456789" \
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 }'
响应
1{
2 "id": "f1a2b3c4-d5e6-7890-abcd-ef0123456789",
3 "created_timestamp": 1751378400,
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}
错误码
| 代码 |
描述 |
| 400 |
请求体无效 |
| 401 |
认证缺失或无效 |
| 404 |
Lambda 未找到 |
评论