AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

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.

When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Please allow a short period of time for changes to take effect.

A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns are triggered when a matching event is observed. Rules with ScheduleExpressions self-trigger based on the given schedule. A rule can have both an EventPattern and a ScheduleExpression, in which case the rule triggers on matching events as well as on a schedule.

Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.

Note:

For PCL this operation is only available in asynchronous form. Please refer to PutRuleAsync.

Namespace: Amazon.CloudWatchEvents
Assembly: AWSSDK.CloudWatchEvents.dll
Version: 3.x.y.z

Syntax

C#
public abstract PutRuleResponse PutRule(
         PutRuleRequest request
)
Parameters
request
Type: Amazon.CloudWatchEvents.Model.PutRuleRequest

Container for the necessary parameters to execute the PutRule service method.

Return Value
The response from the PutRule service method, as returned by CloudWatchEvents.

Exceptions

ExceptionCondition
ConcurrentModificationException There is concurrent modification on a rule or target.
InternalException This exception occurs due to unexpected causes.
InvalidEventPatternException The event pattern is not valid.
LimitExceededException You tried to create more rules or add more targets to a rule than is allowed.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

See Also