UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 4.81 kB
"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__setModuleDefault=exports&&exports.__setModuleDefault||(Object.create?(function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}):function(o,v){o.default=v}),__importStar=exports&&exports.__importStar||(function(){var ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(o2){var ar=[];for(var k in o2)Object.prototype.hasOwnProperty.call(o2,k)&&(ar[ar.length]=k);return ar},ownKeys(o)};return function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k=ownKeys(mod),i=0;i<k.length;i++)k[i]!=="default"&&__createBinding(result,mod,k[i]);return __setModuleDefault(result,mod),result}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.KinesisConsumerEventSource=exports.KinesisEventSource=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var stream_1=()=>{var tmp=require("./stream");return stream_1=()=>tmp,tmp},cdk=()=>{var tmp=__importStar(require("../../core"));return cdk=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class KinesisEventSourceBase extends stream_1().StreamEventSource{source;_eventSourceMappingId=void 0;_eventSourceMappingArn=void 0;startingPositionTimestamp;constructor(source,props){super(props),this.source=source,this.startingPositionTimestamp=props.startingPositionTimestamp,this.props.batchSize!==void 0&&cdk().withResolved(this.props.batchSize,batchSize=>{if(batchSize<1||batchSize>1e4)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`MustBeMaximumBatchSize`,`Maximum batch size must be between 1 and 10000 inclusive (given ${this.props.batchSize})`)})}bind(target){const eventSourceMapping=target.addEventSourceMapping(`${this.source.eventSourceName}:${cdk().Names.nodeUniqueId(this.source.node)}`,this.enrichMappingOptions({eventSourceArn:this.source.sourceArn,startingPositionTimestamp:this.startingPositionTimestamp,metricsConfig:this.props.metricsConfig,supportS3OnFailureDestination:!0}));this._eventSourceMappingId=eventSourceMapping.eventSourceMappingId,this._eventSourceMappingArn=eventSourceMapping.eventSourceMappingArn,this.source.grantRead(target)}get eventSourceMappingId(){if(!this._eventSourceMappingId)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`BoundEventSourceMapping`,`${this.source.eventSourceName} is not yet bound to an event source mapping`);return this._eventSourceMappingId}get eventSourceMappingArn(){if(!this._eventSourceMappingArn)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`BoundEventSourceMapping`,`${this.source.eventSourceName} is not yet bound to an event source mapping`);return this._eventSourceMappingArn}}class KinesisEventSource extends KinesisEventSourceBase{stream;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_lambda_event_sources.KinesisEventSource",version:"2.259.0"};constructor(stream,props){super({...stream,eventSourceName:"KinesisEventSource",sourceArn:stream.streamArn,grantRead:stream.grantRead.bind(stream)},props),this.stream=stream;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}}}exports.KinesisEventSource=KinesisEventSource;class KinesisConsumerEventSource extends KinesisEventSourceBase{streamConsumer;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_lambda_event_sources.KinesisConsumerEventSource",version:"2.259.0"};constructor(streamConsumer,props){super({...streamConsumer,eventSourceName:"KinesisConsumerEventSource",sourceArn:streamConsumer.streamConsumerArn,grantRead:streamConsumer.grantRead.bind(streamConsumer)},props),this.streamConsumer=streamConsumer;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_kinesis_IStreamConsumer(streamConsumer),jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_event_sources_KinesisEventSourceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,KinesisConsumerEventSource),error}}}exports.KinesisConsumerEventSource=KinesisConsumerEventSource;