Todos os produtos
Search
Central de documentação

:Comandos relacionados a gatilhos

Última atualização: Jul 04, 2026

Este tópico descreve os comandos relacionados a gatilhos na Function Compute Command Line Interface (fcli).

Pré-requisitos

Execute fcli shell no diretório que contém o arquivo executável para entrar no modo interativo.

Criar um gatilho (mkt)

Comandos

  • -r string ou --invocation-role string: define a função do gatilho.

  • -s string ou --source-arn string: especifica o Alibaba Cloud Resource Name (ARN) da fonte de eventos, por exemplo, acs:oss:cn-shanghai:12345678:myBucketName.

  • -c string ou --trigger-config string: define o arquivo de configuração do gatilho.

  • -t string ou --type string: especifica o tipo de gatilho. Valor padrão: oss.

Exemplos

  • Crie um gatilho do Object Storage Service (OSS)

    >>> 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: mySuffix                   
  • Crie um gatilho HTTP

    >>> mkt myFunction/myFunctionTrigger -t http  -c code/httpTrigger.yaml
    //The YAML file contains the following triggerConfig content:
      authType: anonymous
      methods:
        - GET                   

Atualizar um gatilho (upt)

  • -r string ou --invocation-role string: define a função do gatilho.

  • -s string ou --source-arn string: especifica o Alibaba Cloud Resource Name (ARN) da fonte de eventos, por exemplo, acs:oss:cn-shanghai:12345678:myBucketName.

  • -c string ou --trigger-config string: define o arquivo de configuração do gatilho.

  • -t string ou --type string: especifica o tipo de gatilho. Valor padrão: 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                   

Referências