CloudWatchEvents class

Amazon EventBridge helps you to respond to state changes in your AWS resources. When your resources change state, they automatically send events into an event stream. You can create rules that match selected events in the stream and route them to targets to take action. You can also use rules to take action on a predetermined schedule. For example, you can configure rules to:

  • Automatically invoke an AWS Lambda function to update DNS entries when an event notifies you that Amazon EC2 instance enters the running state.
  • Direct specific API records from AWS CloudTrail to an Amazon Kinesis data stream for detailed analysis of potential security or availability risks.
  • Periodically invoke a built-in target to create a snapshot of an Amazon EBS volume.
For more information about the features of Amazon EventBridge, see the Amazon EventBridge User Guide.

Constructors

CloudWatchEvents({required String region, AwsClientCredentials? credentials, AwsClientCredentialsProvider? credentialsProvider, Client? client, String? endpointUrl})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

activateEventSource({required String name}) Future<void>
Activates a partner event source that has been deactivated. Once activated, your matching event bus will start receiving events from the event source.
cancelReplay({required String replayName}) Future<CancelReplayResponse>
Cancels the specified replay.
close() → void
Closes the internal HTTP client if none was provided at creation. If a client was passed as a constructor argument, this becomes a noop.
createArchive({required String archiveName, required String eventSourceArn, String? description, String? eventPattern, int? retentionDays}) Future<CreateArchiveResponse>
Creates an archive of events with the specified settings. When you create an archive, incoming events might not immediately start being sent to the archive. Allow a short period of time for changes to take effect. If you do not specify a pattern to filter events sent to the archive, all events are sent to the archive except replayed events. Replayed events are not sent to an archive.
createEventBus({required String name, String? eventSourceName, List<Tag>? tags}) Future<CreateEventBusResponse>
Creates a new event bus within your account. This can be a custom event bus which you can use to receive events from your custom applications and services, or it can be a partner event bus which can be matched to a partner event source.
createPartnerEventSource({required String account, required String name}) Future<CreatePartnerEventSourceResponse>
Called by an SaaS partner to create a partner event source. This operation is not used by AWS customers.
deactivateEventSource({required String name}) Future<void>
You can use this operation to temporarily stop receiving events from the specified partner event source. The matching event bus is not deleted.
deleteArchive({required String archiveName}) Future<void>
Deletes the specified archive.
deleteEventBus({required String name}) Future<void>
Deletes the specified custom event bus or partner event bus. All rules associated with this event bus need to be deleted. You can't delete your account's default event bus.
deletePartnerEventSource({required String account, required String name}) Future<void>
This operation is used by SaaS partners to delete a partner event source. This operation is not used by AWS customers.
deleteRule({required String name, String? eventBusName, bool? force}) Future<void>
Deletes the specified rule.
describeArchive({required String archiveName}) Future<DescribeArchiveResponse>
Retrieves details about an archive.
describeEventBus({String? name}) Future<DescribeEventBusResponse>
Displays details about an event bus in your account. This can include the external AWS accounts that are permitted to write events to your default event bus, and the associated policy. For custom event buses and partner event buses, it displays the name, ARN, policy, state, and creation time.
describeEventSource({required String name}) Future<DescribeEventSourceResponse>
This operation lists details about a partner event source that is shared with your account.
describePartnerEventSource({required String name}) Future<DescribePartnerEventSourceResponse>
An SaaS partner can use this operation to list details about a partner event source that they have created. AWS customers do not use this operation. Instead, AWS customers can use DescribeEventSource to see details about a partner event source that is shared with them.
describeReplay({required String replayName}) Future<DescribeReplayResponse>
Retrieves details about a replay. Use DescribeReplay to determine the progress of a running replay. A replay processes events to replay based on the time in the event, and replays them using 1 minute intervals. If you use StartReplay and specify an EventStartTime and an EventEndTime that covers a 20 minute time range, the events are replayed from the first minute of that 20 minute range first. Then the events from the second minute are replayed. You can use DescribeReplay to determine the progress of a replay. The value returned for EventLastReplayedTime indicates the time within the specified time range associated with the last event replayed.
describeRule({required String name, String? eventBusName}) Future<DescribeRuleResponse>
Describes the specified rule.
disableRule({required String name, String? eventBusName}) Future<void>
Disables the specified rule. A disabled rule won't match any events, and won't self-trigger if it has a schedule expression.
enableRule({required String name, String? eventBusName}) Future<void>
Enables the specified rule. If the rule does not exist, the operation fails.
listArchives({String? eventSourceArn, int? limit, String? namePrefix, String? nextToken, ArchiveState? state}) Future<ListArchivesResponse>
Lists your archives. You can either list all the archives or you can provide a prefix to match to the archive names. Filter parameters are exclusive.
listEventBuses({int? limit, String? namePrefix, String? nextToken}) Future<ListEventBusesResponse>
Lists all the event buses in your account, including the default event bus, custom event buses, and partner event buses.
listEventSources({int? limit, String? namePrefix, String? nextToken}) Future<ListEventSourcesResponse>
You can use this to see all the partner event sources that have been shared with your AWS account. For more information about partner event sources, see CreateEventBus.
listPartnerEventSourceAccounts({required String eventSourceName, int? limit, String? nextToken}) Future<ListPartnerEventSourceAccountsResponse>
An SaaS partner can use this operation to display the AWS account ID that a particular partner event source name is associated with. This operation is not used by AWS customers.
listPartnerEventSources({required String namePrefix, int? limit, String? nextToken}) Future<ListPartnerEventSourcesResponse>
An SaaS partner can use this operation to list all the partner event source names that they have created. This operation is not used by AWS customers.
listReplays({String? eventSourceArn, int? limit, String? namePrefix, String? nextToken, ReplayState? state}) Future<ListReplaysResponse>
Lists your replays. You can either list all the replays or you can provide a prefix to match to the replay names. Filter parameters are exclusive.
listRuleNamesByTarget({required String targetArn, String? eventBusName, int? limit, String? nextToken}) Future<ListRuleNamesByTargetResponse>
Lists the rules for the specified target. You can see which of the rules in Amazon EventBridge can invoke a specific target in your account.
listRules({String? eventBusName, int? limit, String? namePrefix, String? nextToken}) Future<ListRulesResponse>
Lists your Amazon EventBridge rules. You can either list all the rules or you can provide a prefix to match to the rule names.
listTagsForResource({required String resourceARN}) Future<ListTagsForResourceResponse>
Displays the tags associated with an EventBridge resource. In EventBridge, rules and event buses can be tagged.
listTargetsByRule({required String rule, String? eventBusName, int? limit, String? nextToken}) Future<ListTargetsByRuleResponse>
Lists the targets assigned to the specified rule.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putEvents({required List<PutEventsRequestEntry> entries}) Future<PutEventsResponse>
Sends custom events to Amazon EventBridge so that they can be matched to rules.
putPartnerEvents({required List<PutPartnerEventsRequestEntry> entries}) Future<PutPartnerEventsResponse>
This is used by SaaS partners to write events to a customer's partner event bus. AWS customers do not use this operation.
putPermission({String? action, Condition? condition, String? eventBusName, String? policy, String? principal, String? statementId}) Future<void>
Running PutPermission permits the specified AWS account or AWS organization to put events to the specified event bus. Amazon EventBridge (CloudWatch Events) rules in your account are triggered by these events arriving to an event bus in your account.
putRule({required String name, String? description, String? eventBusName, String? eventPattern, String? roleArn, String? scheduleExpression, RuleState? state, List<Tag>? tags}) Future<PutRuleResponse>
Creates or updates the specified rule. Rules are enabled by default, or based on value of the state. You can disable a rule using DisableRule.
putTargets({required String rule, required List<Target> targets, String? eventBusName}) Future<PutTargetsResponse>
Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.
removePermission({String? eventBusName, bool? removeAllPermissions, String? statementId}) Future<void>
Revokes the permission of another AWS account to be able to put events to the specified event bus. Specify the account to revoke by the StatementId value that you associated with the account when you granted it permission with PutPermission. You can find the StatementId by using DescribeEventBus.
removeTargets({required List<String> ids, required String rule, String? eventBusName, bool? force}) Future<RemoveTargetsResponse>
Removes the specified targets from the specified rule. When the rule is triggered, those targets are no longer be invoked.
startReplay({required ReplayDestination destination, required DateTime eventEndTime, required String eventSourceArn, required DateTime eventStartTime, required String replayName, String? description}) Future<StartReplayResponse>
Starts the specified replay. Events are not necessarily replayed in the exact same order that they were added to the archive. A replay processes events to replay based on the time in the event, and replays them using 1 minute intervals. If you specify an EventStartTime and an EventEndTime that covers a 20 minute time range, the events are replayed from the first minute of that 20 minute range first. Then the events from the second minute are replayed. You can use DescribeReplay to determine the progress of a replay. The value returned for EventLastReplayedTime indicates the time within the specified time range associated with the last event replayed.
tagResource({required String resourceARN, required List<Tag> tags}) Future<void>
Assigns one or more tags (key-value pairs) to the specified EventBridge resource. Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values. In EventBridge, rules and event buses can be tagged.
testEventPattern({required String event, required String eventPattern}) Future<TestEventPatternResponse>
Tests whether the specified event pattern matches the provided event.
toString() String
A string representation of this object.
inherited
untagResource({required String resourceARN, required List<String> tagKeys}) Future<void>
Removes one or more tags from the specified EventBridge resource. In Amazon EventBridge (CloudWatch Events, rules and event buses can be tagged.
updateArchive({required String archiveName, String? description, String? eventPattern, int? retentionDays}) Future<UpdateArchiveResponse>
Updates the specified archive.

Operators

operator ==(Object other) bool
The equality operator.
inherited