the-ldk
Version:
Welcome to the LDK! A collection of custom AWS CDK constructs to help you build serverless applications faster.
27 lines • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LDKEventBus = void 0;
const aws_cdk_lib_1 = require("aws-cdk-lib");
const constructs_1 = require("constructs");
const aws_events_1 = require("aws-cdk-lib/aws-events");
class LDKEventBus extends constructs_1.Construct {
constructor(scope, id, props) {
super(scope, id);
const { stage, eventBusName = `ldkEventBus-${id}-${stage}`, description = `ldkEventBus-${id}-${stage} EventBridge event bus`, archive, } = props;
const ldkEventBus = new aws_events_1.EventBus(this, id, {
eventBusName,
description,
});
if (archive) {
const { archiveDescription = `${eventBusName} EventBridge archive`, retentionDays = 7, eventPattern, } = archive;
ldkEventBus.archive(`${eventBusName}-archive`, {
description: archiveDescription,
eventPattern,
retention: aws_cdk_lib_1.Duration.days(retentionDays),
});
}
this.eventBus = ldkEventBus;
}
}
exports.LDKEventBus = LDKEventBus;
//# sourceMappingURL=EventBus.js.map