Class RuleProps
Properties for defining an EventBridge Rule.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Events
Assembly: Amazon.CDK.AWS.Events.dll
Syntax (csharp)
public class RuleProps : Object, IRuleProps
Syntax (vb)
Public Class RuleProps
Inherits Object
Implements IRuleProps
Remarks
ExampleMetadata: infused
Examples
var connection = new Connection(this, "Connection", new ConnectionProps {
Authorization = Authorization.ApiKey("x-api-key", SecretValue.SecretsManager("ApiSecretName")),
Description = "Connection with API Key x-api-key"
});
var destination = new ApiDestination(this, "Destination", new ApiDestinationProps {
Connection = connection,
Endpoint = "https://example.com",
Description = "Calling example.com with API key x-api-key"
});
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Minutes(1)),
Targets = new [] { new ApiDestination(destination) }
});
Synopsis
Constructors
RuleProps() |
Properties
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 | Describes which events EventBridge routes to the specified target. |
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()
public RuleProps()
Properties
Description
A description of the rule's purpose.
public string Description { get; set; }
Property Value
System.String
Remarks
Default: - No description.
Enabled
Indicates whether the rule is enabled.
public Nullable<bool> Enabled { get; set; }
Property Value
System.Nullable<System.Boolean>
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
Describes which events EventBridge routes to the specified target.
public IEventPattern EventPattern { get; set; }
Property Value
Remarks
These routed events are matched events. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide.
Default: - None.
See: https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html
You must specify this property (either via props or via
addEventPattern
), the scheduleExpression
property, or both. The
method addEventPattern
can be used to add filter values to the event
pattern.
RuleName
A name for the rule.
public string RuleName { get; set; }
Property Value
System.String
Remarks
Default: - AWS CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see Name Type.
Schedule
The schedule or rate (frequency) that determines when EventBridge runs the rule.
public Schedule Schedule { get; set; }
Property Value
Remarks
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
You must specify this property, the eventPattern
property, or both.
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.