Skip to content

Instantly share code, notes, and snippets.

@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();
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 ->
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")) {
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();
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)
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");