This topic describes trigger-related commands in Function Compute Command Line Interface (fcli).
Prerequisites
In the folder where the executable file is located, run the fcli shell command to enter the interactive mode.
Create a trigger (mkt)
Commands
-r stringor--invocation-role string: sets the trigger role.-s stringor--source-arn string: specifies the Alibaba Cloud Resource Name (ARN) of the event source, for example, acs:oss:cn-shanghai:12345678:myBucketName.-c stringor--trigger-config string: sets the trigger configuration file.-t stringor--type string: specifies the trigger type. Default value: oss.
Examples
Create an Object Storage Service (OSS) trigger
>>> mkt myFunction/myFunctionTrigger -t oss -r acs:ram::12345678:role/AliyunOSSEventNotificationRole -s acs:oss:cn-shanghai:12345678:myOssBucket -c code/ossTrigger.yaml //The YAML file contains the following triggerConfig content: events: - oss:ObjectCreated:PutObject - oss:ObjectRemoved:DeleteObject filter: key: prefix: myPrefix suffix: mySuffixCreate an HTTP trigger
>>> mkt myFunction/myFunctionTrigger -t http -c code/httpTrigger.yaml //The YAML file contains the following triggerConfig content: authType: anonymous methods: - GET
Update a trigger (upt)
-r stringor--invocation-role string: sets the trigger role.-s stringor--source-arn string: specifies the Alibaba Cloud Resource Name (ARN) of the event source, for example, acs:oss:cn-shanghai:12345678:myBucketName.-c stringor--trigger-config string: sets the trigger configuration file.-t stringor--type string: specifies the trigger type. Default value: oss.
>>> upt myFunction/myFunctionTrigger -t oss -r acs:ram::account_id:role/AliyunOSSEventNotificationRole -s acs:oss:cn-region:account_id:bucketName -c code/trigger.yaml