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的消息队列、消息服务(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"
        ]
      }
    }
  }
}