ALIYUN::FC::Trigger is used to trigger the execution of a function.

In an event-driven computing model, the source is the event producer, the function is the event processor, and the trigger manages different sources in a centralized manner. On the event source side, when an event matching the rules defined by a trigger occurs, the event source invokes the corresponding function.

Syntax

{
  "Type": "ALIYUN::FC::Trigger",
  "Properties": {
    "TriggerConfig": Map,
    "InvocationRole": String,
    "FunctionName": String,
    "ServiceName": String,
    "TriggerName": String,
    "TriggerType": String,
    "SourceArn": String,
    "Qualifier": String
  }
}

Properties

Name Type Required Editable Description Validity
ServiceName String Yes No The name of the service to which the function belongs. The name must be 1 to 128 characters in length.
FunctionName String Yes No The name of the function. None
TriggerName String Yes No The name of the trigger. None
TriggerType String Yes No The type of the trigger. None
TriggerConfig Map Yes Yes The trigger configuration. The configuration varies with the trigger type. None
InvocationRole String Yes Yes

The role used by an event source (such as OSS) to invoke the function.

For example, "acs:ram::1234567890:role/fc-test".
None
SourceArn String Yes Yes

The Alibaba Cloud Resource Name (ARN) of the event source.

For example, "acs:oss:cn-shanghai:12345:mybucket".
None
Qualifier String No No The service version. For example, "LATEST". None

Response parameters

Fn::GetAtt

TriggerId: the unique ID generated by the system for each trigger.

Examples

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Trigger": {
      "Type": "ALIYUN::FC::Trigger",
      "Properties": {
        "TriggerConfig": {
          "Ref": "TriggerConfig"
        },
        "InvocationRole": {
          "Ref": "InvocationRole"
        },
        "FunctionName": {
          "Ref": "FunctionName"
        },
        "ServiceName": {
          "Ref": "ServiceName"
        },
        "TriggerName": {
          "Ref": "TriggerName"
        },
        "TriggerType": {
          "Ref": "TriggerType"
        },
        "SourceArn": {
          "Ref": "SourceArn"
        },
        "Qualifier": {
          "Ref": "Qualifier"
        }
      }
    }
  },
  "Parameters": {
    "TriggerConfig": {
      "Type": "Json",
      "Description": "Event source specific trigger configuration. The value is different according to trigger type."
    },
    "InvocationRole": {
      "Type": "String",
      "Description": "The role grants event source the permission to run function on behalf of the user. This is optional for some triggers.\nExample : \"acs:ram::1234567890:role/fc-test\""
    },
    "FunctionName": {
      "Type": "String",
      "Description": "Function name"
    },
    "ServiceName": {
      "MinLength": 1,
      "Type": "String",
      "Description": "Service name",
      "MaxLength": 128
    },
    "TriggerName": {
      "Type": "String",
      "Description": "Trigger name.\nExample : \"image_resize\""
    },
    "TriggerType": {
      "Type": "String",
      "Description": "Trigger type, e.g. oss, timer, logs. This determines how the trigger config is interpreted.\nExample : \"oss\""
    },
    "SourceArn": {
      "Type": "String",
      "Description": "The Aliyun Resource Name (ARN) of event source. This is optional for some triggers.\nExample : \"acs:oss:cn-shanghai:12345:mybucket\""
    },
    "Qualifier": {
      "Type": "String",
      "Description": "service version or alias.\nExample : \"LATEST\""
    }
  },
  "Outputs": {
    "TriggerId": {
      "Description": "The trigger ID",
      "Value": {
        "Fn::GetAtt": [
          "Trigger",
          "TriggerId"
        ]
      }
    }
  }
}