aws-cdk-lib.aws_events.Archive

class Archive (construct)

LanguageType name
.NETAmazon.CDK.AWS.Events.Archive
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsevents#Archive
Javasoftware.amazon.awscdk.services.events.Archive
Pythonaws_cdk.aws_events.Archive
TypeScript (source)aws-cdk-lib » aws_events » Archive

Implements IConstruct, IDependable, IResource

Define an EventBridge Archive.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_events as events } from 'aws-cdk-lib';

declare const detail: any;
declare const eventBus: events.EventBus;
const archive = new events.Archive(this, 'MyArchive', {
  eventPattern: {
    account: ['account'],
    detail: {
      detailKey: detail,
    },
    detailType: ['detailType'],
    id: ['id'],
    region: ['region'],
    resources: ['resources'],
    source: ['source'],
    time: ['time'],
    version: ['version'],
  },
  sourceEventBus: eventBus,

  // the properties below are optional
  archiveName: 'archiveName',
  description: 'description',
  retention: cdk.Duration.minutes(30),
});

Initializer

new Archive(scope: Construct, id: string, props: ArchiveProps)

Parameters

  • scope Construct
  • id string
  • props ArchiveProps

Construct Props

NameTypeDescription
eventPatternEventPatternAn event pattern to use to filter events sent to the archive.
sourceEventBusIEventBusThe event source associated with the archive.
archiveName?stringThe name of the archive.
description?stringA description for the archive.
retention?DurationThe number of days to retain events for.

eventPattern

Type: EventPattern

An event pattern to use to filter events sent to the archive.


sourceEventBus

Type: IEventBus

The event source associated with the archive.


archiveName?

Type: string (optional, default: Automatically generated)

The name of the archive.


description?

Type: string (optional, default: none)

A description for the archive.


retention?

Type: Duration (optional, default: Infinite)

The number of days to retain events for.

Default value is 0. If set to 0, events are retained indefinitely.

Properties

NameTypeDescription
archiveArnstringThe ARN of the archive created.
archiveNamestringThe archive name.
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.

archiveArn

Type: string

The ARN of the archive created.


archiveName

Type: string

The archive name.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
toString()Returns a string representation of this construct.

applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.