@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
174 lines • 6.54 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.EventArchive = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an EventBridge event archive 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 order = new aws.cloudwatch.EventBus("order", {name: "orders"});
* const orderEventArchive = new aws.cloudwatch.EventArchive("order", {
* name: "order-archive",
* eventSourceArn: order.arn,
* });
* ```
*
* ### Optional Arguments
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const order = new aws.cloudwatch.EventBus("order", {name: "orders"});
* const orderEventArchive = new aws.cloudwatch.EventArchive("order", {
* name: "order-archive",
* description: "Archived events from order service",
* eventSourceArn: order.arn,
* retentionDays: 7,
* eventPattern: JSON.stringify({
* source: ["company.team.order"],
* }),
* });
* ```
*
* ### CMK Encryption
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const current = aws.getCallerIdentity({});
* const currentGetPartition = aws.getPartition({});
* const example = new aws.cloudwatch.EventBus("example", {name: "example"});
* const exampleKey = new aws.kms.Key("example", {
* deletionWindowInDays: 7,
* policy: pulumi.jsonStringify({
* Version: "2012-10-17",
* Id: "key-policy-example",
* Statement: [
* {
* Sid: "Enable IAM User Permissions",
* Effect: "Allow",
* Principal: {
* AWS: Promise.all([currentGetPartition, current]).then(([currentGetPartition, current]) => `arn:${currentGetPartition.partition}:iam::${current.accountId}:root`),
* },
* Action: "kms:*",
* Resource: "*",
* },
* {
* Sid: "Allow describing of the key",
* Effect: "Allow",
* Principal: {
* Service: "events.amazonaws.com",
* },
* Action: ["kms:DescribeKey"],
* Resource: "*",
* },
* {
* Sid: "Allow use of the key",
* Effect: "Allow",
* Principal: {
* Service: "events.amazonaws.com",
* },
* Action: [
* "kms:GenerateDataKey",
* "kms:Decrypt",
* "kms:ReEncrypt*",
* ],
* Resource: "*",
* Condition: {
* StringEquals: {
* "kms:EncryptionContext:aws:events:event-bus:arn": example.arn,
* },
* },
* },
* ],
* }),
* tags: {
* EventBridgeApiDestinations: "true",
* },
* });
* const exampleEventArchive = new aws.cloudwatch.EventArchive("example", {
* name: "example",
* eventSourceArn: example.arn,
* kmsKeyIdentifier: exampleKey.id,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import an EventBridge archive using the `name`. For example:
*
* ```sh
* $ pulumi import aws:cloudwatch/eventArchive:EventArchive imported_event_archive order-archive
* ```
*/
class EventArchive extends pulumi.CustomResource {
/**
* Get an existing EventArchive 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 EventArchive(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of EventArchive. 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'] === EventArchive.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["description"] = state?.description;
resourceInputs["eventPattern"] = state?.eventPattern;
resourceInputs["eventSourceArn"] = state?.eventSourceArn;
resourceInputs["kmsKeyIdentifier"] = state?.kmsKeyIdentifier;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
resourceInputs["retentionDays"] = state?.retentionDays;
}
else {
const args = argsOrState;
if (args?.eventSourceArn === undefined && !opts.urn) {
throw new Error("Missing required property 'eventSourceArn'");
}
resourceInputs["description"] = args?.description;
resourceInputs["eventPattern"] = args?.eventPattern;
resourceInputs["eventSourceArn"] = args?.eventSourceArn;
resourceInputs["kmsKeyIdentifier"] = args?.kmsKeyIdentifier;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["retentionDays"] = args?.retentionDays;
resourceInputs["arn"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(EventArchive.__pulumiType, name, resourceInputs, opts);
}
}
exports.EventArchive = EventArchive;
/** @internal */
EventArchive.__pulumiType = 'aws:cloudwatch/eventArchive:EventArchive';
//# sourceMappingURL=eventArchive.js.map
;