This file contains hidden or 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
| DataCollectionStack dataCollectionStack = new DataCollectionStack(app, "DataCollectionStack", StackProps.builder() | |
| .env(Environment.builder() | |
| .account(System.getenv("CDK_ACCOUNT_ID")) | |
| .region("us-west-2") | |
| .build()) | |
| .build()); | |
| Tags.of(dataCollectionStack).add("wf:owner", "data"); |
This file contains hidden or 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
| private void createMobileCollectionResource(RestApi api, String platformResourceName) { | |
| Resource mobileResource = api.getRoot().addResource(platformResourceName); | |
| KinesisPipeline pipeline = createKinesisPipeline(platformResourceName); | |
| kinesisPipelines.add(pipeline); | |
| AnalyticsEventProcessor processor = AnalyticsEventProcessor.Builder.create(this, | |
| String.format("Analytics%sEventProcessor", capitalize(platformResourceName))) | |
| .platformName(platformResourceName) | |
| .stream(pipeline.getStream()) | |
| .lambdaExecutionRole(awsLambdaAnalyticsExecution) |
This file contains hidden or 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
| public KinesisPipeline(final Construct scope, final String id, final KinesisPipelineProps props) { | |
| super(scope, id); | |
| firehoseDeliveryRole = props.getFirehoseDeliveryRole(); | |
| lambdaExecutionRole = props.getLambdaExecutionRole(); | |
| streamKey = props.getStreamKey(); | |
| catalogId = props.getCatalogId(); | |
| glueDatabaseName = props.getGlueDatabaseName(); | |
| glueTableName = props.getGlueTableName(); | |
| streamId = props.getStreamId(); |
This file contains hidden or 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
| public AnalyticsEventProcessor(final Construct scope, final String id, final AnalyticsEventProcessorProps props) { | |
| super(scope, id); | |
| platformName = props.getPlatformName(); | |
| stream = props.getStream(); | |
| lambdaExecutionRole = props.getLambdaExecutionRole(); | |
| routingLambda = props.getRoutingLambda(); | |
| reprocessingLambda = props.getReprocessingLambda(); | |
| if (Objects.equals(System.getenv("CDK_ENVIRONMENT"), "production")) { |
This file contains hidden or 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
| public AnalyticsEventMonitor(final Construct scope, final String id, final AnalyticsEventMonitorProps props) { | |
| super(scope, id); | |
| lambdaExecutionRole = props.getLambdaExecutionRole(); | |
| dlqTopics = props.getDlqTopics(); | |
| infraLambda = props.getInfraLambda(); | |
| getProperties(); | |
| monitoringAlarms.addAll(props.getKinesisPipelines().stream() | |
| .map(pipeline -> |
This file contains hidden or 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
| @Test | |
| public void testResourceCountCorrect() { | |
| Template template = getStackTemplate(); | |
| template.resourceCountIs("AWS::Kinesis::Stream", 1); | |
| template.resourceCountIs("AWS::KinesisFirehose::DeliveryStream", 2); | |
| } | |
| @Test | |
| public void testStreamsConfigured() { | |
| Template template = getStackTemplate(); |