@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
120 lines • 4.98 kB
JavaScript
// *** 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.NotificationRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a CodeStar Notifications Rule.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const code = new aws.codecommit.Repository("code", {repositoryName: "example-code-repo"});
* const notif = new aws.sns.Topic("notif", {name: "notification"});
* const notifAccess = aws.iam.getPolicyDocumentOutput({
* statements: [{
* actions: ["sns:Publish"],
* principals: [{
* type: "Service",
* identifiers: ["codestar-notifications.amazonaws.com"],
* }],
* resources: [notif.arn],
* }],
* });
* const _default = new aws.sns.TopicPolicy("default", {
* arn: notif.arn,
* policy: notifAccess.apply(notifAccess => notifAccess.json),
* });
* const commits = new aws.codestarnotifications.NotificationRule("commits", {
* detailType: "BASIC",
* eventTypeIds: ["codecommit-repository-comments-on-commits"],
* name: "example-code-repo-commits",
* resource: code.arn,
* targets: [{
* address: notif.arn,
* }],
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import CodeStar notification rule using the ARN. For example:
*
* ```sh
* $ pulumi import aws:codestarnotifications/notificationRule:NotificationRule foo arn:aws:codestar-notifications:us-west-1:0123456789:notificationrule/2cdc68a3-8f7c-4893-b6a5-45b362bd4f2b
* ```
*/
class NotificationRule extends pulumi.CustomResource {
/**
* Get an existing NotificationRule 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 NotificationRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of NotificationRule. 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'] === NotificationRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["detailType"] = state?.detailType;
resourceInputs["eventTypeIds"] = state?.eventTypeIds;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
resourceInputs["resource"] = state?.resource;
resourceInputs["status"] = state?.status;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["targets"] = state?.targets;
}
else {
const args = argsOrState;
if (args?.detailType === undefined && !opts.urn) {
throw new Error("Missing required property 'detailType'");
}
if (args?.eventTypeIds === undefined && !opts.urn) {
throw new Error("Missing required property 'eventTypeIds'");
}
if (args?.resource === undefined && !opts.urn) {
throw new Error("Missing required property 'resource'");
}
resourceInputs["detailType"] = args?.detailType;
resourceInputs["eventTypeIds"] = args?.eventTypeIds;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["resource"] = args?.resource;
resourceInputs["status"] = args?.status;
resourceInputs["tags"] = args?.tags;
resourceInputs["targets"] = args?.targets;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NotificationRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.NotificationRule = NotificationRule;
/** @internal */
NotificationRule.__pulumiType = 'aws:codestarnotifications/notificationRule:NotificationRule';
//# sourceMappingURL=notificationRule.js.map
;