a 2b@sPddlmZmZmZmZmZmZ m Z m Z mZmZddlmZGdddeZdS)) DurationStack RemovalPolicyaws_ec2 aws_lambda aws_dynamodb aws_kinesisaws_logs aws_eventsaws_events_targets) Constructcs>eZdZeeddfdd ZeddZeddZZ S) IngestionStackN)scope construct_idreturnc stj||fi||jd}tj|ddt|dtjj tj j d|_ tj|ddt|dtjj tj j d|_ tj|dd tjd tjjd tjjtjd }tj|d tdtjjgd}tj|dtjjddtdd|gd|j jdtddd }|j || |t!j"|dt!j#$tdd}|%t&'|tj|dtjjddtdd|gd|j jdtddd } |j | | | |%t&'| dS)Ningestion_configz order-stream order_streamretention_period) stream_namer stream_mode encryptionzcustomer-streamcustomer_streamTableZ latest_keyid)nametype) table_name partition_key billing_moderemoval_policyz lambda-layerz lambda/layer/)codecompatible_runtimeszcustomer-lambdaz-Lambda function deployed using AWS CDK Pythonz./lambda/code/customerz customer_producer.lambda_handlerINFO)Z LOG_LEVELZ STREAM_NAME<) runtime function_name descriptionr handlerlayers environmenttimeoutreserved_concurrent_executionsZ StepTrigger)schedulez order-lambdaz./lambda/code/orderzorder_producer.lambda_handler)(super__init__nodetry_get_context_kinesisStreamrhours StreamMode ON_DEMANDStreamEncryption UNENCRYPTEDrr _dynamodbr Attribute AttributeTypeNUMBER BillingModePAY_PER_REQUESTrDESTROY_lambda LayerVersion AssetCodeRuntime PYTHON_3_8Functionrsecondsgrant_read_writegrant_read_write_data_eventsRuleSchedulerate add_target_events_targetsLambdaFunction) selfrrkwargsrZdynamodb_tableZ lambdaLayerZcustomer_lambdaZ step_triggerZ order_lambda __class__/Users/sbeath/Documents/2. Internal/redshift-streaming-workshop/amazon-redshift-streaming-workshop/redshift_streaming/ingestion_stack.pyr/s         zIngestionStack.__init__cCs|jSN)rrPrTrTrUget_customer_streamlsz"IngestionStack.get_customer_streamcCs|jSrV)rrWrTrTrUget_order_streampszIngestionStack.get_order_stream) __name__ __module__ __qualname__r strr/propertyrXrY __classcell__rTrTrRrUr s Y r N)aws_cdkrrrrZ_ec2rr@rr9rr2r Z_logsr rIr rN constructsr r rTrTrTrUs0