Trigger-related commands

Updated at:

This topic describes the trigger-related commands in fcli.

Prerequisites

Run fcli shell in the directory that contains the executable file to enter interactive mode.

Create a trigger (mkt)

Command

  • -r string or --invocation-role string: Specifies the invocation role.

  • -s string or --source-arn string: The Alibaba Cloud Resource Name (ARN) of the event source. For example, acs:oss:cn-shanghai:12345678:myBucketName.

  • -c string or --trigger-config string: Specifies the configuration file for the trigger.

  • -t string or --type string: Specifies the trigger type. The default value is oss.

Examples

  • Create an 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 content of the YAML file for triggerConfig is as follows:
        events:
            - oss:ObjectCreated:PutObject
            - oss:ObjectRemoved:DeleteObject
        filter:
            key:
                prefix: myPrefix
                suffix: mySuffix                   
  • Create an HTTP trigger

    >>> mkt myFunction/myFunctionTrigger -t http  -c code/httpTrigger.yaml
    // The content of the YAML file is as follows for triggerConfig:
      authType: anonymous
      methods:
        - GET                   

Update a trigger (upt)

  • -r string or --invocation-role string: Specifies the invocation role.

  • -s string or --source-arn string: The Alibaba Cloud Resource Name (ARN) of the event source. For example, acs:oss:cn-shanghai:12345678:myBucketName.

  • -c string or --trigger-config string: Specifies the configuration file for the trigger.

  • -t string or --type string: Specifies the trigger type. The default value is 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                   

More information