UNPKG

@pulumi/aws

Version:

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

124 lines 5.13 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"); /** * Provides an EventBridge Rule resource. * * > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const console = new aws.cloudwatch.EventRule("console", { * name: "capture-aws-sign-in", * description: "Capture each AWS Console Sign In", * eventPattern: JSON.stringify({ * "detail-type": ["AWS Console Sign In via CloudTrail"], * }), * }); * const awsLogins = new aws.sns.Topic("aws_logins", {name: "aws-console-logins"}); * const sns = new aws.cloudwatch.EventTarget("sns", { * rule: console.name, * targetId: "SendToSNS", * arn: awsLogins.arn, * }); * const snsTopicPolicy = aws.iam.getPolicyDocumentOutput({ * statements: [{ * effect: "Allow", * actions: ["SNS:Publish"], * principals: [{ * type: "Service", * identifiers: ["events.amazonaws.com"], * }], * resources: [awsLogins.arn], * }], * }); * const _default = new aws.sns.TopicPolicy("default", { * arn: awsLogins.arn, * policy: snsTopicPolicy.apply(snsTopicPolicy => snsTopicPolicy.json), * }); * ``` * * ## Import * * Using `pulumi import`, import EventBridge Rules using the `event_bus_name/rule_name` (if you omit `event_bus_name`, the `default` event bus will be used). For example: * * ```sh * $ pulumi import aws:cloudwatch/eventRule:EventRule console example-event-bus/capture-console-sign-in * ``` */ 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["description"] = state?.description; resourceInputs["eventBusName"] = state?.eventBusName; resourceInputs["eventPattern"] = state?.eventPattern; resourceInputs["forceDestroy"] = state?.forceDestroy; resourceInputs["isEnabled"] = state?.isEnabled; resourceInputs["name"] = state?.name; resourceInputs["namePrefix"] = state?.namePrefix; resourceInputs["region"] = state?.region; resourceInputs["roleArn"] = state?.roleArn; resourceInputs["scheduleExpression"] = state?.scheduleExpression; resourceInputs["state"] = state?.state; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; } else { const args = argsOrState; resourceInputs["description"] = args?.description; resourceInputs["eventBusName"] = args?.eventBusName; resourceInputs["eventPattern"] = args?.eventPattern; resourceInputs["forceDestroy"] = args?.forceDestroy; resourceInputs["isEnabled"] = args?.isEnabled; resourceInputs["name"] = args?.name; resourceInputs["namePrefix"] = args?.namePrefix; resourceInputs["region"] = args?.region; resourceInputs["roleArn"] = args?.roleArn; resourceInputs["scheduleExpression"] = args?.scheduleExpression; resourceInputs["state"] = args?.state; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(EventRule.__pulumiType, name, resourceInputs, opts); } } exports.EventRule = EventRule; /** @internal */ EventRule.__pulumiType = 'aws:cloudwatch/eventRule:EventRule'; //# sourceMappingURL=eventRule.js.map