interface RuleProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Events.RuleProps |
Java | software.amazon.awscdk.services.events.RuleProps |
Python | aws_cdk.aws_events.RuleProps |
TypeScript (source) | @aws-cdk/aws-events » RuleProps |
Properties for defining an EventBridge Rule.
Example
const connection = new events.Connection(this, 'Connection', {
authorization: events.Authorization.apiKey('x-api-key', SecretValue.secretsManager('ApiSecretName')),
description: 'Connection with API Key x-api-key',
});
const destination = new events.ApiDestination(this, 'Destination', {
connection,
endpoint: 'https://example.com',
description: 'Calling example.com with API key x-api-key',
});
const rule = new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(cdk.Duration.minutes(1)),
targets: [new targets.ApiDestination(destination)],
});
Properties
Name | Type | Description |
---|---|---|
description? | string | A description of the rule's purpose. |
enabled? | boolean | Indicates whether the rule is enabled. |
event | IEvent | The event bus to associate with this rule. |
event | Event | Describes which events EventBridge routes to the specified target. |
rule | string | A name for the rule. |
schedule? | Schedule | The schedule or rate (frequency) that determines when EventBridge runs the rule. |
targets? | IRule [] | Targets to invoke when this rule matches an event. |
description?
Type:
string
(optional, default: No description.)
A description of the rule's purpose.
enabled?
Type:
boolean
(optional, default: true)
Indicates whether the rule is enabled.
eventBus?
Type:
IEvent
(optional, default: The default event bus.)
The event bus to associate with this rule.
eventPattern?
Type:
Event
(optional, default: None.)
Describes which events EventBridge routes to the specified target.
These routed events are matched events. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide.
See also: [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.](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?
Type:
string
(optional, default: AWS CloudFormation generates a unique physical ID and uses that ID
for the rule name. For more information, see Name Type.)
A name for the rule.
schedule?
Type:
Schedule
(optional, default: None.)
The schedule or rate (frequency) that determines when EventBridge runs the rule.
For more information, see Schedule Expression Syntax for Rules in the Amazon EventBridge User Guide.
See also: [https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html
You must specify this property, the eventPattern
property, or both.](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html
You must specify this property, the eventPattern
property, or both.)
targets?
Type:
IRule
[]
(optional, default: No targets.)
Targets to invoke when this rule matches an event.
Input will be the full matched event. If you wish to specify custom
target input, use addTarget(target[, inputOptions])
.