"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiGateway=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),iam=require("../../aws-iam"),util_1=require("./util");class ApiGateway{constructor(restApi,props){this.restApi=restApi,this.props=props,jsiiDeprecationWarnings.aws_cdk_lib_aws_apigateway_RestApi(restApi),jsiiDeprecationWarnings.aws_cdk_lib_aws_events_targets_ApiGatewayProps(props)}bind(rule,_id){var _b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s;if(jsiiDeprecationWarnings.aws_cdk_lib_aws_events_IRule(rule),((_b=this.props)===null||_b===void 0?void 0:_b.deadLetterQueue)&&util_1.addToDeadLetterQueueResourcePolicy(rule,this.props.deadLetterQueue),((_f=(_e=(_d=(_c=this.props)===null||_c===void 0?void 0:_c.path)===null||_d===void 0?void 0:_d.match(/\*/g))===null||_e===void 0?void 0:_e.length)!==null&&_f!==void 0?_f:0)!==(((_g=this.props)===null||_g===void 0?void 0:_g.pathParameterValues)||[]).length)throw new Error("The number of wildcards in the path does not match the number of path pathParameterValues.");const restApiArn=this.restApi.arnForExecuteApi((_h=this.props)===null||_h===void 0?void 0:_h.method,((_j=this.props)===null||_j===void 0?void 0:_j.path)||"/",((_k=this.props)===null||_k===void 0?void 0:_k.stage)||this.restApi.deploymentStage.stageName);return{...this.props?util_1.bindBaseTargetConfig(this.props):{},arn:restApiArn,role:((_l=this.props)===null||_l===void 0?void 0:_l.eventRole)||util_1.singletonEventRole(this.restApi,[new iam.PolicyStatement({resources:[restApiArn],actions:["execute-api:Invoke","execute-api:ManageConnections"]})]),deadLetterConfig:((_m=this.props)===null||_m===void 0?void 0:_m.deadLetterQueue)&&{arn:(_o=this.props.deadLetterQueue)===null||_o===void 0?void 0:_o.queueArn},input:(_p=this.props)===null||_p===void 0?void 0:_p.postBody,targetResource:this.restApi,httpParameters:{headerParameters:(_q=this.props)===null||_q===void 0?void 0:_q.headerParameters,queryStringParameters:(_r=this.props)===null||_r===void 0?void 0:_r.queryStringParameters,pathParameterValues:(_s=this.props)===null||_s===void 0?void 0:_s.pathParameterValues}}}}exports.ApiGateway=ApiGateway,_a=JSII_RTTI_SYMBOL_1,ApiGateway[_a]={fqn:"aws-cdk-lib.aws_events_targets.ApiGateway",version:"2.13.0"};
//# sourceMappingURL=api-gateway.js.map
