Class EventRule
Provides a CloudWatch Event Rule resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var console = new Aws.CloudWatch.EventRule("console", new Aws.CloudWatch.EventRuleArgs
{
Description = "Capture each AWS Console Sign In",
EventPattern = @"{
""detail-type"": [
""AWS Console Sign In via CloudTrail""
]
}
",
});
var awsLogins = new Aws.Sns.Topic("awsLogins", new Aws.Sns.TopicArgs
{
});
var sns = new Aws.CloudWatch.EventTarget("sns", new Aws.CloudWatch.EventTargetArgs
{
Arn = awsLogins.Arn,
Rule = console.Name,
});
var snsTopicPolicy = awsLogins.Arn.Apply(arn => Aws.Iam.GetPolicyDocument.InvokeAsync(new Aws.Iam.GetPolicyDocumentArgs
{
Statements =
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementArgs
{
Actions =
{
"SNS:Publish",
},
Effect = "Allow",
Principals =
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalArgs
{
Identifiers =
{
"events.amazonaws.com",
},
Type = "Service",
},
},
Resources =
{
arn,
},
},
},
}));
var @default = new Aws.Sns.TopicPolicy("default", new Aws.Sns.TopicPolicyArgs
{
Arn = awsLogins.Arn,
Policy = snsTopicPolicy.Apply(snsTopicPolicy => snsTopicPolicy.Json),
});
}
}
Inherited Members
Namespace: Pulumi.Aws.CloudWatch
Assembly: Pulumi.Aws.dll
Syntax
public class EventRule : CustomResource
Constructors
View SourceEventRule(String, EventRuleArgs, CustomResourceOptions)
Create a EventRule resource with the given unique name, arguments, and options.
Declaration
public EventRule(string name, EventRuleArgs args = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| EventRuleArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceArn
The Amazon Resource Name (ARN) of the rule.
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Description
The description of the rule.
Declaration
public Output<string> Description { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
EventPattern
Event pattern described a JSON object. See full documentation of CloudWatch Events and Event Patterns for details.
Declaration
public Output<string> EventPattern { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
IsEnabled
Whether the rule should be enabled (defaults to true).
Declaration
public Output<bool?> IsEnabled { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Name
The rule's name. By default generated by this provider.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
NamePrefix
The rule's name. Conflicts with name.
Declaration
public Output<string> NamePrefix { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RoleArn
The Amazon Resource Name (ARN) associated with the role that is used for target invocation.
Declaration
public Output<string> RoleArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ScheduleExpression
The scheduling expression.
For example, cron(0 20 * * ? *) or rate(5 minutes).
Declaration
public Output<string> ScheduleExpression { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
A map of tags to assign to the resource.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
Methods
View SourceGet(String, Input<String>, EventRuleState, CustomResourceOptions)
Get an existing EventRule resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static EventRule Get(string name, Input<string> id, EventRuleState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| EventRuleState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| EventRule |