Invoking a Function
Before invoking a function, obtain the URN, as shown in Figure 1.
Synchronous Invocation
The following is an example command for synchronous invocation. For details about the parameters, see Table 1.
hcloud FunctionGraph InvokeFunction --cli-region="ap-southeast-1" --X-Cff-Log-Type="tail" --X-CFF-Request-Version="v1" --function_urn="urn:fss:cn-east-3:******:function:default:hcloud-invoke:latest" --project_id="******" --key="value"
Parameter |
Mandatory |
Description |
---|---|---|
--cli-region |
Yes |
Region where the target function is located. |
--function_urn |
Yes |
Function URN. |
--project_id |
Yes |
Project ID. |
--X-Cff-Log-Type |
No |
Options: tail (4 KB logs will be returned in the header) and null (no logs will be returned). |
X-CFF-Request-Version |
No |
Response body format. Options:
|
Body |
Yes |
Request body in --key="value" format. The JSON structure is {"key":"value"}. |
Figure 2 shows the output result. For details about the response parameters, see Table 2.
Asynchronous Invocation
The following is an example command for asynchronous invocation. For details about the parameters, see Table 3.
hcloud FunctionGraph AsyncInvokeFunction --cli-region="cn-east-3" --function_urn="urn:fss:cn-east-3:******:function:default:hcloud-invoke:latest" --project_id="******" --key="value"
Parameter |
Mandatory |
Description |
---|---|---|
--cli-region |
Yes |
Region where the target function is located. |
--function_urn |
Yes |
Function URN. |
--project_id |
Yes |
Project ID. |
Body |
Yes |
Request body in --key="value" format. The JSON structure is { "key":"value"}. |
Figure 3 shows the output result. For details about the response parameters, see Table 2.
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Request ID. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.