ALIYUN::EventBridge::Rule類型用於在指定的事件匯流排下建立一個事件規則。
文法
{
"Type": "ALIYUN::EventBridge::Rule",
"Properties": {
"Status": String,
"EventBusName": String,
"FilterPattern": Map,
"Description": String,
"Targets": List,
"RuleName": String
}
}屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
EventBusName | String | 是 | 否 | 事件匯流排的名稱。 | 更多資訊,請參見使用限制。 |
FilterPattern | Map | 是 | 是 | 事件模式。 | JSON格式。取值:
說明 最多可容納5個事件模式。 |
Targets | List | 是 | 是 | 事件的投遞目標。 | 更多資訊,請參見Targets屬性。 |
RuleName | String | 是 | 否 | 事件規則的名稱。 | 更多資訊,請參見使用限制。 |
Status | String | 否 | 是 | 規則的狀態。 | 取值:
|
Description | String | 否 | 是 | 規則說明。 | 無 |
Targets文法
"Targets": [
{
"PushRetryStrategy": String,
"Type": String,
"Endpoint": String,
"Id": String,
"ParamList": List,
"DeadLetterQueue": Map,
"ConcurrentConfig": Map,
"ErrorsTolerance": String
}
]Targets屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Endpoint | String | 是 | 否 | 投遞端點連結。 | 無 |
Id | String | 是 | 否 | 自訂TargetId。 | 無 |
ParamList | List | 是 | 否 | 事件傳遞的參數。 | 更多資訊,請參見ParamList屬性。 |
Type | String | 是 | 否 | 目標Target類型。 | 無 |
PushRetryStrategy | String | 否 | 否 | 推送重試策略。 | 取值:
|
DeadLetterQueue | Map | 否 | 否 | 無效信件佇列。 | 未處理或超過最大重試次數的事件將寫入無效信件佇列。以下隊列類型支援無效信件佇列功能:Apache RocketMQ的訊息佇列、Message Service(MNS)、Apache Kafka的訊息佇列和EventBridge。更多資訊,請參考DeadLetterQueue屬性。 |
ConcurrentConfig | Map | 否 | 否 | 並發控制配置。 | 更多資訊。請參考ConcurrentConfig屬性。 |
ErrorsTolerance | String | 否 | 否 | 容錯策略。 | 取值:
|
DeadLetterQueue文法
"DeadLetterQueue":
{
"Arn": String
}DeadLetterQueue屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Arn | String | 是 | 否 | 無效信件佇列的阿里雲資源名稱(ARN)。 | 未處理或超過最大重試次數的事件將寫入無效信件佇列。以下隊列類型支援ARN功能:Apache RocketMQ的MNS和訊息佇列。 |
ConcurrentConfig文法
"ConcurrentConfig":
{
"Concurrency": Integer
}ConcurrentConfig屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Concurrency | Integer | 是 | 否 | 並發串連數。 | 無 |
ParamList文法
"ParamList": [
{
"Form": String,
"Value": String,
"ResourceKey": String,
"Template": String
}
]ParamList屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Form | String | 是 | 否 | 事件轉換的格式。 | 更多資訊,請參見事件目標參數。 |
ResourceKey | String | 是 | 否 | 事件轉換的資源參數。 | 更多資訊,請參見事件目標參數。 |
Value | String | 是 | 否 | 事件轉換的值。 | 無 |
Template | String | 否 | 否 | 模板樣式。 | 無 |
傳回值
Fn::GetAtt
EventBusName:事件匯流排的名稱。
RuleARN:事件規則的ARN,用於授權。
RuleName:事件規則的名稱。
樣本
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
EventBusName:
Type: String
Description: The name of the event bus.
Targets:
Type: Json
Description: The event target to which events are delivered.
MinLength: 1
MaxLength: 5
RuleName:
Type: String
Description: The name of the event rule.
FilterPattern:
Required: true
Type: Json
Description:
en: The event pattern, in the JSON format.
Label:
zh-cn: 事件模式
en: FilterPattern
Resources:
Rule:
Type: ALIYUN::EventBridge::Rule
Properties:
FilterPattern:
Ref: FilterPattern
EventBusName:
Ref: EventBusName
Targets:
Ref: Targets
RuleName:
Ref: RuleName
Outputs:
EventBusName:
Description: The name of the event bus.
Value:
Fn::GetAtt:
- Rule
- EventBusName
RuleARN:
Description: The Alibaba Cloud Resource Name (ARN) of the event rule. The ARN is used for authorization.
Value:
Fn::GetAtt:
- Rule
- RuleARN
RuleName:
Description: The name of the event rule.
Value:
Fn::GetAtt:
- Rule
- RuleName
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"EventBusName": {
"Type": "String",
"Description": "The name of the event bus."
},
"Targets": {
"Type": "Json",
"Description": "The event target to which events are delivered.",
"MinLength": 1,
"MaxLength": 5
},
"RuleName": {
"Type": "String",
"Description": "The name of the event rule."
},
"FilterPattern": {
"Required": true,
"Type": "Json",
"Description": {
"en": "The event pattern, in the JSON format."
},
"Label": {
"zh-cn": "事件模式",
"en": "FilterPattern"
}
}
},
"Resources": {
"Rule": {
"Type": "ALIYUN::EventBridge::Rule",
"Properties": {
"FilterPattern": {
"Ref": "FilterPattern"
},
"EventBusName": {
"Ref": "EventBusName"
},
"Targets": {
"Ref": "Targets"
},
"RuleName": {
"Ref": "RuleName"
}
}
}
},
"Outputs": {
"EventBusName": {
"Description": "The name of the event bus.",
"Value": {
"Fn::GetAtt": [
"Rule",
"EventBusName"
]
}
},
"RuleARN": {
"Description": "The Alibaba Cloud Resource Name (ARN) of the event rule. The ARN is used for authorization.",
"Value": {
"Fn::GetAtt": [
"Rule",
"RuleARN"
]
}
},
"RuleName": {
"Description": "The name of the event rule.",
"Value": {
"Fn::GetAtt": [
"Rule",
"RuleName"
]
}
}
}
}