EventRule class
Resource for managing an AWS User Notifications Event Rule.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.notifications.NotificationConfiguration("example", {
name: "example",
description: "example configuration",
});
const exampleEventRule = new aws.notifications.EventRule("example", {
eventPattern: JSON.stringify({
detail: {
state: {
value: ["ALARM"],
},
},
}),
eventType: "CloudWatch Alarm State Change",
notificationConfigurationArn: example.arn,
regions: [
"us-east-1",
"us-west-2",
],
source: "aws.cloudwatch",
});
import pulumi
import json
import pulumi_aws as aws
example = aws.notifications.NotificationConfiguration("example",
name="example",
description="example configuration")
example_event_rule = aws.notifications.EventRule("example",
event_pattern=json.dumps({
"detail": {
"state": {
"value": ["ALARM"],
},
},
}),
event_type="CloudWatch Alarm State Change",
notification_configuration_arn=example.arn,
regions=[
"us-east-1",
"us-west-2",
],
source="aws.cloudwatch")
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Notifications.NotificationConfiguration("example", new()
{
Name = "example",
Description = "example configuration",
});
var exampleEventRule = new Aws.Notifications.EventRule("example", new()
{
EventPattern = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["detail"] = new Dictionary<string, object?>
{
["state"] = new Dictionary<string, object?>
{
["value"] = new[]
{
"ALARM",
},
},
},
}),
EventType = "CloudWatch Alarm State Change",
NotificationConfigurationArn = example.Arn,
Regions = new[]
{
"us-east-1",
"us-west-2",
},
Source = "aws.cloudwatch",
});
});
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/notifications"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := notifications.NewNotificationConfiguration(ctx, "example", ¬ifications.NotificationConfigurationArgs{
Name: pulumi.String("example"),
Description: pulumi.String("example configuration"),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]map[string]map[string][]string{
"detail": map[string]map[string][]string{
"state": map[string][]string{
"value": []string{
"ALARM",
},
},
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = notifications.NewEventRule(ctx, "example", ¬ifications.EventRuleArgs{
EventPattern: pulumi.String(json0),
EventType: pulumi.String("CloudWatch Alarm State Change"),
NotificationConfigurationArn: example.Arn,
Regions: pulumi.StringArray{
pulumi.String("us-east-1"),
pulumi.String("us-west-2"),
},
Source: pulumi.String("aws.cloudwatch"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_notifications_notificationconfiguration" "example" {
name = "example"
description = "example configuration"
}
resource "aws_notifications_eventrule" "example" {
event_pattern = jsonencode({
"detail" = {
"state" = {
"value" = ["ALARM"]
}
}
})
event_type = "CloudWatch Alarm State Change"
notification_configuration_arn = aws_notifications_notificationconfiguration.example.arn
regions = ["us-east-1", "us-west-2"]
source = "aws.cloudwatch"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.notifications.NotificationConfiguration;
import com.pulumi.aws.notifications.NotificationConfigurationArgs;
import com.pulumi.aws.notifications.EventRule;
import com.pulumi.aws.notifications.EventRuleArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new NotificationConfiguration("example", NotificationConfigurationArgs.builder()
.name("example")
.description("example configuration")
.build());
var exampleEventRule = new EventRule("exampleEventRule", EventRuleArgs.builder()
.eventPattern(serializeJson(
jsonObject(
jsonProperty("detail", jsonObject(
jsonProperty("state", jsonObject(
jsonProperty("value", jsonArray("ALARM"))
))
))
)))
.eventType("CloudWatch Alarm State Change")
.notificationConfigurationArn(example.arn())
.regions(
"us-east-1",
"us-west-2")
.source("aws.cloudwatch")
.build());
}
}
resources:
example:
type: aws:notifications:NotificationConfiguration
properties:
name: example
description: example configuration
exampleEventRule:
type: aws:notifications:EventRule
name: example
properties:
eventPattern:
fn::toJSON:
detail:
state:
value:
- ALARM
eventType: CloudWatch Alarm State Change
notificationConfigurationArn: ${example.arn}
regions:
- us-east-1
- us-west-2
source: aws.cloudwatch
Import
Using pulumi import, import User Notifications Event Rule using the arn. For example:
$ pulumi import aws:notifications/eventRule:EventRule example arn:aws:notifications::123456789012:configuration/abc123def456ghi789jkl012mno345/rule/abc123def456ghi789jkl012mno345
Constructors
- EventRule(String name, {EventRuleArgs? args, CustomResourceOptions? options})
-
Creates a new EventRule.
nameThe Pulumi resource name.argsArguments used to configure this EventRule. The set of arguments for EventRule.optionsResource options controlling this resource's behavior. - EventRule.reference(String urn)
- Creates a typed reference to an existing EventRule resource.
Properties
-
arn
↔ Output<
String> -
ARN of the Event Rule.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
eventPattern
↔ Output<
String?> -
JSON string defining the event pattern to match. Maximum length is 4096 characters.
latefinal
-
eventType
↔ Output<
String> -
Type of event to match. Must be between 1 and 128 characters, and match the pattern
([a-zA-Z0-9 \-\(\)])+.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
notificationConfigurationArn
↔ Output<
String> -
ARN of the notification configuration to associate with this event rule. Must match the pattern
arn:aws:notifications::[0-9]{12}:configuration/[a-z0-9]{27}.latefinal -
regions
↔ Output<
List< String> > -
Set of AWS regions where the event rule will be applied. Each region must be between 2 and 25 characters, and match the pattern
([a-z]{1,2})-([a-z]{1,15}-)+([0-9]).latefinal -
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
source
↔ Output<
String> -
Source of the event. Must be between 1 and 36 characters, and match the pattern
aws.([a-z0-9\-])+.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited