@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
111 lines • 4.52 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.EventPermission = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to create an EventBridge permission to support cross-account events in the current account default event bus.
*
* > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
*
* > **Note:** The EventBridge bus policy resource (`aws.cloudwatch.EventBusPolicy`) is incompatible with the EventBridge permission resource (`aws.cloudwatch.EventPermission`) and will overwrite permissions.
*
* ## Example Usage
*
* ### Account Access
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const devAccountAccess = new aws.cloudwatch.EventPermission("DevAccountAccess", {
* principal: "123456789012",
* statementId: "DevAccountAccess",
* });
* ```
*
* ### Organization Access
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const organizationAccess = new aws.cloudwatch.EventPermission("OrganizationAccess", {
* principal: "*",
* statementId: "OrganizationAccess",
* condition: {
* key: "aws:PrincipalOrgID",
* type: "StringEquals",
* value: example.id,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import EventBridge permissions using the `event_bus_name/statement_id` (if you omit `event_bus_name`, the `default` event bus will be used). For example:
*
* ```sh
* $ pulumi import aws:cloudwatch/eventPermission:EventPermission DevAccountAccess example-event-bus/DevAccountAccess
* ```
*/
class EventPermission extends pulumi.CustomResource {
/**
* Get an existing EventPermission 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 EventPermission(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of EventPermission. 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'] === EventPermission.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state?.action;
resourceInputs["condition"] = state?.condition;
resourceInputs["eventBusName"] = state?.eventBusName;
resourceInputs["principal"] = state?.principal;
resourceInputs["region"] = state?.region;
resourceInputs["statementId"] = state?.statementId;
}
else {
const args = argsOrState;
if (args?.principal === undefined && !opts.urn) {
throw new Error("Missing required property 'principal'");
}
if (args?.statementId === undefined && !opts.urn) {
throw new Error("Missing required property 'statementId'");
}
resourceInputs["action"] = args?.action;
resourceInputs["condition"] = args?.condition;
resourceInputs["eventBusName"] = args?.eventBusName;
resourceInputs["principal"] = args?.principal;
resourceInputs["region"] = args?.region;
resourceInputs["statementId"] = args?.statementId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(EventPermission.__pulumiType, name, resourceInputs, opts);
}
}
exports.EventPermission = EventPermission;
/** @internal */
EventPermission.__pulumiType = 'aws:cloudwatch/eventPermission:EventPermission';
//# sourceMappingURL=eventPermission.js.map
;