UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 1.96 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.KinesisEventSource=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cdk=require("../../core"),stream_1=require("./stream");class KinesisEventSource extends stream_1.StreamEventSource{constructor(stream,props){super(props),this.stream=stream,this._eventSourceMappingId=void 0;try{jsiiDeprecationWarnings.aws_cdk_lib_aws_kinesis_IStream(stream),jsiiDeprecationWarnings.aws_cdk_lib_aws_lambda_event_sources_KinesisEventSourceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,KinesisEventSource),error}this.startingPositionTimestamp=props.startingPositionTimestamp,this.props.batchSize!==void 0&&cdk.withResolved(this.props.batchSize,batchSize=>{if(batchSize<1||batchSize>1e4)throw new Error(`Maximum batch size must be between 1 and 10000 inclusive (given ${this.props.batchSize})`)})}bind(target){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_lambda_IFunction(target)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}const eventSourceMapping=target.addEventSourceMapping(`KinesisEventSource:${cdk.Names.nodeUniqueId(this.stream.node)}`,this.enrichMappingOptions({eventSourceArn:this.stream.streamArn,startingPositionTimestamp:this.startingPositionTimestamp}));this._eventSourceMappingId=eventSourceMapping.eventSourceMappingId,this.stream.grantRead(target),this.stream.grant(target,"kinesis:DescribeStream")}get eventSourceMappingId(){if(!this._eventSourceMappingId)throw new Error("KinesisEventSource is not yet bound to an event source mapping");return this._eventSourceMappingId}}exports.KinesisEventSource=KinesisEventSource,_a=JSII_RTTI_SYMBOL_1,KinesisEventSource[_a]={fqn:"aws-cdk-lib.aws_lambda_event_sources.KinesisEventSource",version:"2.70.0"};