"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.LambdaDestination=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp};class LambdaDestination{constructor(fn,options={}){this.fn=fn,this.options=options;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_IFunction(fn),jsiiDeprecationWarnings().aws_cdk_lib_aws_logs_destinations_LambdaDestinationOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,LambdaDestination),error}}bind(scope,logGroup){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_logs_ILogGroup(logGroup)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}const arn=logGroup.logGroupArn;if(this.options.addPermissions!==!1){const permissionId="CanInvokeLambda";this.fn.addPermission(permissionId,{principal:new(iam()).ServicePrincipal("logs.amazonaws.com"),sourceArn:arn,scope});const cfnPermission=scope.node.tryFindChild(permissionId);cfnPermission&&scope.node.addDependency(cfnPermission)}return{arn:this.fn.functionArn}}}exports.LambdaDestination=LambdaDestination,_a=JSII_RTTI_SYMBOL_1,LambdaDestination[_a]={fqn:"aws-cdk-lib.aws_logs_destinations.LambdaDestination",version:"2.148.1"};
