ALIYUN::FC::Trigger is used to trigger the invocation of a function.
In an event-driven computing model, event sources produce events, functions process the events, and triggers are used to manage different event sources in a centralized manner. On the event source side, when an event that matches the rules defined by a trigger occurs, the event source invokes the relevant function.
Syntax
{
"Type": "ALIYUN::FC::Trigger",
"Properties": {
"TriggerConfig": Map,
"InvocationRole": String,
"FunctionName": String,
"ServiceName": String,
"TriggerName": String,
"TriggerType": String,
"Qualifier": String,
"SourceArn": String
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
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 for which you want to create a trigger. | None. |
TriggerName | String | Yes | No | The name of the trigger. | The name must be 1 to 128 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). The name must start with a letter or an underscore (_). |
TriggerType | String | Yes | No | The type of trigger. | Valid values:
|
TriggerConfig | Map | Yes | Yes | The configurations of the trigger. | The configurations vary based on the trigger type. |
InvocationRole | String | No | Yes | The trigger role that is used to grant an event source the permissions to invoke the function on behalf of yourself. Example: | This property is optional when TriggerType is set to timer or http. This property is required when TriggerType is set to a value other than timer and http. The following section lists the trusted entities and policies for role authorization for different types of triggers:
|
SourceArn | String | No | No | The Alibaba Cloud Resource Name (ARN) of the event source. | This property is optional when TriggerType is set to timer or http. This property is required when TriggerType is set to a value other than timer and http. The following section lists the formats and examples of event source ARNs for different types of triggers:
Note Replace |
Qualifier | String | No | Yes | The version of the trigger. | Default value: LATEST. |
oss-TriggerConfig syntax
"TriggerConfig": {
"BucketName": String,
"Events": List,
"Filter": Map
}
oss-TriggerConfig properties
Property | Type | Required | Editable | Description | Constraint |
BucketName | String | Yes | No | The name of the bucket. | You must select an OSS bucket as the event source. Buckets within the same region are displayed in the Bucket drop-down list. |
Events | String | Yes | Yes | The trigger events, which represent the operations performed on Alibaba Cloud resources. | Example: |
Filter | Map | No | Yes | The trigger rule, which is used to avoid cyclic triggering. | The values of Prefix and Suffix must be custom strings. Example:
|
log-TriggerConfig syntax
"TriggerConfig": {
"SourceConfig": Map,
"LogConfig": Map,
"JobConfig": Map,
"FunctionParameter": Map,
"Enable": Boolean
}
log-TriggerConfig properties
Property | Type | Required | Editable | Description | Constraint |
SourceConfig | Map | Yes | No | The configurations of the Logstore. | Example: |
LogConfig | Map | Yes | Yes | The configurations of the Log Service project and the Logstore for the trigger. | Project: the Log Service project. This property is required but not editable. LogStore: the Logstore for the trigger. This property is optional and editable. The Logstore cannot be the same as the value of LogStore in the SourceConfig property. Example: |
JobConfig | Map | Yes | Yes | The triggering configurations, which specify the maximum number of retries and the trigger interval. | MaxRetryTime: the trigger interval. Unit: seconds. TriggerInterval: the maximum number of retries. Valid values: 0 to 100. Example: |
FunctionParameter | Map | Yes | Yes | The function configurations that are used to pass parameters to the function. | If you do not want to pass parameters, set the value to braces ({ }). |
Enable | Boolean | Yes | Yes | Specifies whether to enable the trigger. | Valid values:
|
timer-TriggerConfig syntax
"TriggerConfig": {
"Payload": String,
"CronExpression": String,
"Enabled": Boolean
}
timer-TriggerConfig properties
Property | Type | Required | Editable | Description | Constraint |
Payload | String | No | Yes | The trigger message. | None. |
CronExpression | String | Yes | Yes | The CRON expression that is used to specify the trigger time. | The CRON expression uses Coordinated Universal Time (UTC). |
Enabled | Boolean | Yes | Yes | Specifies whether to enable the trigger. | Valid values:
|
tablestore-TriggerConfig syntax
"TriggerConfig",: {
"InstanceName": String,
"TableName": String
}
tablestore-TriggerConfig properties
Property | Type | Required | Editable | Description | Constraint |
InstanceName | String | Yes | No | The name of the Tablestore instance. | None. |
TableName | String | Yes | No | The name of the data table. | None. |
mns_topic-TriggerConfig syntax
"TriggerConfig": {
"NotifyStrategy": String,
"NotifyContentFormat": String,
"FilterTag": String
}
mns_topic-TriggerConfig properties
Property | Type | Required | Editable | Description | Constraint |
NotifyStrategy | String | Yes | No | The retry policy. | Valid values:
For more information, see NotifyStrategy. |
NotifyContentFormat | String | Yes | No | The format of the event. | Valid values:
|
FilterTag | String | No | No | The filter tag. | None. |
cdn-TriggerConfig syntax
"TriggerConfig": {
"EventName": String,
"EventVersion": String,
"Notes": String,
"Filter": List
}
cdn-TriggerConfig properties
Property | Type | Required | Editable | Description | Constraint |
EventName | String | Yes | No | The trigger event. | Valid values:
|
EventVersion | String | Yes | No | The version of the trigger event. | None. |
Notes | String | Yes | Yes | The remarks. | None. |
Filter | List | Yes | Yes | The filters. | The key of each filter is |
http-TriggerConfig syntax
You can create an HTTP trigger only when you create a function. When an HTTP trigger is configured for a function, you cannot create other types of triggers for the function.
"TriggerConfig": {
"AuthType": String,
"Methods": List
}
http-TriggerConfig properties
Property | Type | Required | Editable | Description | Constraint |
AuthType | String | Yes | No | The authentication method. | Valid values:
|
Methods | List | Yes | No | The request methods. | Valid values:
Examples: |
Return values
Fn::GetAtt
TriggerId: the unique ID generated by the system for each trigger.
ServiceName: the name of the service to which the function belongs.
FunctionName: the name of the function.
TriggerName: the name of the trigger.
UrlInternet: the public domain address.
UrlIntranet: the private domain address.