Class RuleProps
Properties for defining an EventBridge Rule.
Inherited Members
Namespace: Amazon.CDK.AWS.Events
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class RuleProps : IRuleProps, IEventCommonOptions
Syntax (vb)
Public Class RuleProps Implements IRuleProps, IEventCommonOptions
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.RedshiftServerless;
CfnWorkgroup workgroup;
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
var dlq = new Queue(this, "DeadLetterQueue");
rule.AddTarget(new RedshiftQuery(workgroup.AttrWorkgroupWorkgroupArn, new RedshiftQueryProps {
Database = "dev",
DeadLetterQueue = dlq,
Sql = new [] { "SELECT * FROM foo", "SELECT * FROM baz" }
}));
Synopsis
Constructors
RuleProps() | Properties for defining an EventBridge Rule. |
Properties
CrossStackScope | The scope to use if the source of the rule and its target are in different Stacks (but in the same account & region). |
Description | A description of the rule's purpose. |
Enabled | Indicates whether the rule is enabled. |
EventBus | The event bus to associate with this rule. |
EventPattern | Additional restrictions for the event to route to the specified target. |
Role | The role that is used for target invocation. |
RuleName | A name for the rule. |
Schedule | The schedule or rate (frequency) that determines when EventBridge runs the rule. |
Targets | Targets to invoke when this rule matches an event. |
Constructors
RuleProps()
Properties for defining an EventBridge Rule.
public RuleProps()
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.RedshiftServerless;
CfnWorkgroup workgroup;
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
var dlq = new Queue(this, "DeadLetterQueue");
rule.AddTarget(new RedshiftQuery(workgroup.AttrWorkgroupWorkgroupArn, new RedshiftQueryProps {
Database = "dev",
DeadLetterQueue = dlq,
Sql = new [] { "SELECT * FROM foo", "SELECT * FROM baz" }
}));
Properties
CrossStackScope
The scope to use if the source of the rule and its target are in different Stacks (but in the same account & region).
public Construct? CrossStackScope { get; set; }
Property Value
Construct
Remarks
This helps dealing with cycles that often arise in these situations.
Default: - none (the main scope will be used, even for cross-stack Events)
Description
A description of the rule's purpose.
public string? Description { get; set; }
Property Value
Remarks
Default: - No description
Enabled
Indicates whether the rule is enabled.
public bool? Enabled { get; set; }
Property Value
bool?
Remarks
Default: true
EventBus
The event bus to associate with this rule.
public IEventBus? EventBus { get; set; }
Property Value
Remarks
Default: - The default event bus.
EventPattern
Additional restrictions for the event to route to the specified target.
public IEventPattern? EventPattern { get; set; }
Property Value
Remarks
The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering.
Default: - No additional filtering based on an event pattern.
Role
The role that is used for target invocation.
public IRole? Role { get; set; }
Property Value
Remarks
Must be assumable by principal events.amazonaws.com
.
Default: - No role associated
RuleName
A name for the rule.
public string? RuleName { get; set; }
Property Value
Remarks
Default: AWS CloudFormation generates a unique physical ID.
Schedule
The schedule or rate (frequency) that determines when EventBridge runs the rule.
public Schedule? Schedule { get; set; }
Property Value
Remarks
You must specify this property, the eventPattern
property, or both.
For more information, see Schedule Expression Syntax for Rules in the Amazon EventBridge User Guide.
Default: - None.
See: https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html
Targets
Targets to invoke when this rule matches an event.
public IRuleTarget[]? Targets { get; set; }
Property Value
Remarks
Input will be the full matched event. If you wish to specify custom
target input, use addTarget(target[, inputOptions])
.
Default: - No targets.