"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiEventSource=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var apigw=()=>{var tmp=require("../../aws-apigateway");return apigw=()=>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 ApiEventSource{method;path;options;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_lambda_event_sources.ApiEventSource",version:"2.256.1"};constructor(method,path,options){this.method=method,this.path=path,this.options=options;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_apigateway_MethodOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ApiEventSource),error}if(!path.startsWith("/"))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`PathStart`,`Path must start with "/": ${path}`)}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 id=`${core_1().Names.nodeUniqueId(target.node)}:ApiEventSourceA7A86A4F`,stack=core_1().Stack.of(target);let api=stack.node.tryFindChild(id);api||(api=new(apigw()).RestApi(stack,id,{defaultIntegration:new(apigw()).LambdaIntegration(target)})),api.root.resourceForPath(this.path).addMethod(this.method,void 0,this.options)}}exports.ApiEventSource=ApiEventSource;
