Asynchronous invocation-related commands

更新时间:
复制 MD 格式

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:

ParameterRequiredDescription
--regionYesThe region where your resources are deployed.
--access, -aNoThe alias of the key to use.
--apiVersionNoThe API version. Valid values: 20210416, 20160815.
--serviceName (path)YesThe service name.
--functionName (path)YesThe function name.
--qualifier (path)NoThe service alias or version.
--destinationConfig (body)NoThe destination for asynchronous invocations.
--maxAsyncEventAgeInSeconds (body)NoThe maximum time-to-live (TTL) of messages.
--maxAsyncRetryAttempts (body)NoThe maximum number of retries.
--statefulInvocation (body)NoSpecifies 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:

ParameterRequiredDescription
--regionYesThe region where your resources are deployed.
--access, -aNoThe alias of the key to use.
--apiVersionNoThe API version. Valid values: 20210416, 20160815.
--serviceName (path)YesThe service name.
--functionName (path)YesThe function name.
--qualifier (path)NoThe 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:

ParameterRequiredDescription
--regionYesThe region where your resources are deployed.
--access, -aNoThe alias of the key to use.
--apiVersionNoThe API version. Valid values: 20210416, 20160815.
--serviceName (path)YesThe service name.
--functionName (path)YesThe function name.
--qualifier (path)NoThe 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:

ParameterRequiredDescription
--regionYesThe region where your resources are deployed.
--access, -aNoThe alias of the key to use.
--apiVersionNoThe API version. Valid values: 20210416, 20160815.
--serviceName (path)YesThe service name.
--functionName (path)YesThe function name.
--limit (query)NoThe maximum number of configurations to return.
--nextToken (query)NoThe 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.