调用 invoke
更新时间 2025-10-23 09:41:28
最近更新时间: 2025-10-23 09:41:28
invoke命令调用部署在函数计算的函数。
参数解析
| 参数全称 | 参数缩写 | Yaml 模式下必填 | Cli 模式下必填 | 参数含义 |
|---|---|---|---|---|
| region | - | 选填 | 必填 | 资源池ID,请参考资源池列表 |
| function-name | - | 选填 | 必填 | 函数名称 |
| timeout | - | 选填 | 选填 | 客户端调用超时时间,默认为:1800,单位为:秒 |
| event | e | 选填 | 选填 | 事件 |
| wait-function-ready | - | 选填 | 选填 | 等待函数就绪再调用,默认值:false,最大等待时间为120秒,等待间隔为10秒 |
操作案例
Yaml 模式
进入到资源描述文件(s.yaml)所在的路径,然后执行如下命令调用函数:
s invokeCli 模式
直接执行如下命令调用函数:
s cli faas-cf invoke --region bb9fdb42056f11eda1610242ac110002 --function-name hello-world执行完成输出示例:
status: 200
headers:
content-length: 11
content-type: text/plain; charset=utf-8
date: Tue, 27 May 2025 08:06:01 GMT
x-fc-request-id: cfece192-0449-4de4-bf5f-180700006fa8
x-fc-status-code: 200
x-fc-upstream-service-time: 2781
x-fc-req-cost-time: 2782
x-fc-req-arrive-time: 1748333160021
x-fc-resp-start-time: 1748333162803
connection: close
body: hello world
__component: faas-cf