UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

112 lines 4.42 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.EventRule = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource for managing an AWS User Notifications Event Rule. * * ## Example Usage * * ### Basic Usage * * ```typescript * 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 * * Using `pulumi import`, import User Notifications Event Rule using the `arn`. For example: * * ```sh * $ pulumi import aws:notifications/eventRule:EventRule example arn:aws:notifications::123456789012:configuration/abc123def456ghi789jkl012mno345/rule/abc123def456ghi789jkl012mno345 * ``` */ class EventRule extends pulumi.CustomResource { /** * Get an existing EventRule resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new EventRule(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of EventRule. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === EventRule.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["eventPattern"] = state?.eventPattern; resourceInputs["eventType"] = state?.eventType; resourceInputs["notificationConfigurationArn"] = state?.notificationConfigurationArn; resourceInputs["regions"] = state?.regions; resourceInputs["source"] = state?.source; } else { const args = argsOrState; if (args?.eventType === undefined && !opts.urn) { throw new Error("Missing required property 'eventType'"); } if (args?.notificationConfigurationArn === undefined && !opts.urn) { throw new Error("Missing required property 'notificationConfigurationArn'"); } if (args?.regions === undefined && !opts.urn) { throw new Error("Missing required property 'regions'"); } if (args?.source === undefined && !opts.urn) { throw new Error("Missing required property 'source'"); } resourceInputs["eventPattern"] = args?.eventPattern; resourceInputs["eventType"] = args?.eventType; resourceInputs["notificationConfigurationArn"] = args?.notificationConfigurationArn; resourceInputs["regions"] = args?.regions; resourceInputs["source"] = args?.source; resourceInputs["arn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(EventRule.__pulumiType, name, resourceInputs, opts); } } exports.EventRule = EventRule; /** @internal */ EventRule.__pulumiType = 'aws:notifications/eventRule:EventRule'; //# sourceMappingURL=eventRule.js.map