The FC component, built on Serverless Devs, provides CLI commands for managing asynchronous invocation configurations on Alibaba Cloud Function Compute.
Prerequisites
Before you begin, ensure that you have:
Create or update an asynchronous invocation configuration
API operation: PutFunctionAsyncInvokeConfig
Syntax:
sudo s cli fc api PutFunctionAsyncInvokeConfig
--region <regionId>
[--access <accessName>]
[--apiVersion <20210416|20160815>]
--path '{"serviceName": "<serviceName>", "functionName": "<functionName>", ["qualifier": "<qualifier>"]}'
[--body '{"destinationConfig": "<destinationConfig>", "maxAsyncEventAgeInSeconds": "<maxAsyncEventAgeInSeconds>", "maxAsyncRetryAttempts": "<maxAsyncRetryAttempts>", "statefulInvocation": <true|false>}']Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where your resources are deployed. |
--access, -a | No | The alias of the key to use. |
--apiVersion | No | The API version. Valid values: 20210416, 20160815. |
--serviceName (path) | Yes | The service name. |
--functionName (path) | Yes | The function name. |
--qualifier (path) | No | The service alias or version. |
--destinationConfig (body) | No | The destination for asynchronous invocations. |
--maxAsyncEventAgeInSeconds (body) | No | The maximum time-to-live (TTL) of messages. |
--maxAsyncRetryAttempts (body) | No | The maximum number of retries. |
--statefulInvocation (body) | No | Specifies whether to enable stateful asynchronous invocation. Valid values: true, false. |
Example — To enable stateful invocation:
sudo s cli fc api PutFunctionAsyncInvokeConfig --region cn-hangzhou --access default --path '{"serviceName": "mytest","functionName": "mytest"}' --body '{"statefulInvocation": true}'For the full API reference, see PutFunctionAsyncInvokeConfig.
Delete an asynchronous invocation configuration
API operation: DeleteFunctionAsyncInvokeConfig
Syntax:
sudo s cli fc api DeleteFunctionAsyncInvokeConfig
--region <regionId>
[--access <accessName>]
[--apiVersion <20210416|20160815>]
--path '{"serviceName": "<serviceName>", "functionName": "<functionName>", ["qualifier": "<qualifier>"]}'Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where your resources are deployed. |
--access, -a | No | The alias of the key to use. |
--apiVersion | No | The API version. Valid values: 20210416, 20160815. |
--serviceName (path) | Yes | The service name. |
--functionName (path) | Yes | The function name. |
--qualifier (path) | No | The service alias or version. |
Example — To delete a configuration:
sudo s cli fc api DeleteFunctionAsyncInvokeConfig --region cn-hangzhou --access default --path '{"serviceName": "mytest","functionName": "mytest"}'For the full API reference, see DeleteFunctionAsyncInvokeConfig.
Query an asynchronous invocation configuration
API operation: GetFunctionAsyncInvokeConfig
Syntax:
sudo s cli fc api GetFunctionAsyncInvokeConfig
--region <regionId>
[--access <accessName>]
[--apiVersion <20210416|20160815>]
--path '{"serviceName": "<serviceName>", "functionName": "<functionName>", ["qualifier": "<qualifier>"]}'Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where your resources are deployed. |
--access, -a | No | The alias of the key to use. |
--apiVersion | No | The API version. Valid values: 20210416, 20160815. |
--serviceName (path) | Yes | The service name. |
--functionName (path) | Yes | The function name. |
--qualifier (path) | No | The service alias or version. |
Example — To retrieve a configuration:
sudo s cli fc api GetFunctionAsyncInvokeConfig --region cn-hangzhou --access default --path '{"serviceName": "mytest","functionName": "mytest"}'For the full API reference, see GetFunctionAsyncInvokeConfig.
List asynchronous invocation configurations
API operation: ListFunctionAsyncInvokeConfigs
Syntax:
sudo s cli fc api ListFunctionAsyncInvokeConfigs
--region <regionId>
[--access <accessName>]
[--apiVersion <20210416|20160815>]
--path '{"serviceName": "<serviceName>", "functionName": "<functionName>"}'
[--query '{"limit": "<limit>", "nextToken": "<nextToken>"}']Parameters:
| Parameter | Required | Description |
|---|---|---|
--region | Yes | The region where your resources are deployed. |
--access, -a | No | The alias of the key to use. |
--apiVersion | No | The API version. Valid values: 20210416, 20160815. |
--serviceName (path) | Yes | The service name. |
--functionName (path) | Yes | The function name. |
--limit (query) | No | The maximum number of configurations to return. |
--nextToken (query) | No | The pagination token from a previous response. Omit this parameter on the first call; include it in subsequent calls to retrieve the next page of results. |
Example — To list configurations with a page size of 10:
sudo s cli fc api ListFunctionAsyncInvokeConfigs --region cn-hangzhou --access default --path '{"serviceName": "mytest","functionName": "mytest"}' --query '{"limit":"10"}'For the full API reference, see ListFunctionAsyncInvokeConfigs.