-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into cloudformation-integ-test
- Loading branch information
Showing
25 changed files
with
496 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { Duration, Resource } from '@aws-cdk/core'; | ||
import { Construct } from 'constructs'; | ||
import { IEventBus } from './event-bus'; | ||
import { EventPattern } from './event-pattern'; | ||
import { CfnArchive } from './events.generated'; | ||
|
||
/** | ||
* The event archive base properties | ||
*/ | ||
export interface BaseArchiveProps { | ||
/** | ||
* The name of the archive. | ||
* | ||
* @default - Automatically generated | ||
*/ | ||
readonly archiveName?: string; | ||
/** | ||
* A description for the archive. | ||
* | ||
* @default - none | ||
*/ | ||
readonly description?: string; | ||
/** | ||
* An event pattern to use to filter events sent to the archive. | ||
*/ | ||
readonly eventPattern: EventPattern; | ||
/** | ||
* The number of days to retain events for. Default value is 0. If set to 0, events are retained indefinitely. | ||
* @default - Infinite | ||
*/ | ||
readonly retention?: Duration; | ||
} | ||
|
||
|
||
/** | ||
* The event archive properties | ||
*/ | ||
export interface ArchiveProps extends BaseArchiveProps { | ||
/** | ||
* The event source associated with the archive. | ||
*/ | ||
readonly sourceEventBus: IEventBus; | ||
} | ||
|
||
/** | ||
* Define an EventBridge Archive | ||
* | ||
* @resource AWS::Events::Archive | ||
*/ | ||
export class Archive extends Resource { | ||
/** | ||
* The archive name. | ||
* @attribute | ||
*/ | ||
public readonly archiveName: string; | ||
|
||
/** | ||
* The ARN of the archive created. | ||
* @attribute | ||
*/ | ||
public readonly archiveArn: string; | ||
|
||
constructor(scope: Construct, id: string, props: ArchiveProps) { | ||
super(scope, id, { physicalName: props.archiveName }); | ||
|
||
let archive = new CfnArchive(this, 'Archive', { | ||
sourceArn: props.sourceEventBus.eventBusArn, | ||
description: props.description, | ||
eventPattern: props.eventPattern, | ||
retentionDays: props.retention?.toDays({ integral: true }) || 0, | ||
archiveName: this.physicalName, | ||
}); | ||
|
||
this.archiveArn = archive.attrArn; | ||
this.archiveName = archive.attrArchiveName; | ||
} | ||
} |
Oops, something went wrong.