"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiDestination=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),util_1=require("./util"),iam=require("../../aws-iam");class ApiDestination{constructor(apiDestination,props={}){this.apiDestination=apiDestination,this.props=props;try{jsiiDeprecationWarnings.aws_cdk_lib_aws_events_IApiDestination(apiDestination),jsiiDeprecationWarnings.aws_cdk_lib_aws_events_targets_ApiDestinationProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ApiDestination),error}}bind(_rule,_id){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_events_IRule(_rule)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}const httpParameters=this.props.headerParameters??this.props.pathParameterValues??this.props.queryStringParameters?{headerParameters:this.props.headerParameters,pathParameterValues:this.props.pathParameterValues,queryStringParameters:this.props.queryStringParameters}:void 0;this.props?.deadLetterQueue&&(0,util_1.addToDeadLetterQueueResourcePolicy)(_rule,this.props.deadLetterQueue);const role=this.props?.eventRole??(0,util_1.singletonEventRole)(this.apiDestination);return role.addToPrincipalPolicy(new iam.PolicyStatement({resources:[this.apiDestination.apiDestinationArn],actions:["events:InvokeApiDestination"]})),{...this.props?(0,util_1.bindBaseTargetConfig)(this.props):{},arn:this.apiDestination.apiDestinationArn,role,input:this.props.event,targetResource:this.apiDestination,httpParameters}}}exports.ApiDestination=ApiDestination,_a=JSII_RTTI_SYMBOL_1,ApiDestination[_a]={fqn:"aws-cdk-lib.aws_events_targets.ApiDestination",version:"2.96.1"};
