Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(event-source): add archive bucket as event source #625

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export const icav2PipelineCacheBucket: Record<AppStage, string> = {
[AppStage.PROD]: 'pipeline-prod-cache-503977275616-ap-southeast-2',
};

// The archive bucket. Noting that this is only present for prod data.
export const icav2ArchiveAnalysisBucket: Record<AppStage.PROD, string> = {
[AppStage.PROD]: 'archive-prod-analysis-503977275616-ap-southeast-2',
};

export const gdsBsRunsUploadLogPath: Record<AppStage, string> = {
[AppStage.BETA]: 'gds://development/primary_data/temp/bs_runs_upload_tes/',
[AppStage.GAMMA]: 'gds://staging/primary_data/temp/bs_runs_upload_tes/',
Expand Down
24 changes: 17 additions & 7 deletions config/stacks/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ import { AuroraPostgresEngineVersion } from 'aws-cdk-lib/aws-rds';
import { ConfigurableDatabaseProps } from '../../lib/workload/stateful/stacks/shared/constructs/database';
import { SharedStackProps } from '../../lib/workload/stateful/stacks/shared/stack';
import {
AppStage,
accountIdAlias,
AppStage,
computeSecurityGroupName,
databasePort,
dataSchemaRegistryName,
dbClusterEndpointHostParameterName,
dbClusterIdentifier,
dbClusterResourceIdParameterName,
eventBusName,
eventSchemaRegistryName,
eventSourceQueueName,
icav2ArchiveAnalysisBucket,
icav2PipelineCacheBucket,
oncoanalyserBucket,
rdsMasterSecretName,
eventSchemaRegistryName,
dataSchemaRegistryName,
vpcProps,
oncoanalyserBucket,
icav2PipelineCacheBucket,
} from '../constants';
import { Duration, RemovalPolicy } from 'aws-cdk-lib';
import { SchemaRegistryProps } from '../../lib/workload/stateful/stacks/shared/constructs/schema-registry';
import {
EventBusProps,
EventBusArchiverProps,
EventBusProps,
} from '../../lib/workload/stateful/stacks/shared/constructs/event-bus';
import { ComputeProps } from '../../lib/workload/stateful/stacks/shared/constructs/compute';
import { EventSourceProps } from '../../lib/workload/stateful/stacks/shared/constructs/event-source';
Expand Down Expand Up @@ -88,7 +89,7 @@ const getComputeConstructProps = (): ComputeProps => {
};

const getEventSourceConstructProps = (stage: AppStage): EventSourceProps => {
return {
const props = {
queueName: eventSourceQueueName,
maxReceiveCount: 3,
rules: [
Expand All @@ -103,6 +104,15 @@ const getEventSourceConstructProps = (stage: AppStage): EventSourceProps => {
},
],
};

if (stage === AppStage.PROD) {
props.rules.push({
bucket: icav2ArchiveAnalysisBucket[stage],
eventTypes: ['Object Created', 'Object Deleted'],
});
}

return props;
};

const getDatabaseConstructProps = (stage: AppStage): ConfigurableDatabaseProps => {
Expand Down