aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 1.36 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpApiHelper=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp};class HttpApiHelper{httpApi;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_apigatewayv2.HttpApiHelper",version:"2.246.0"};static fromHttpApi(httpApi){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_apigatewayv2_IHttpApiRef(httpApi)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromHttpApi),error}return new HttpApiHelper(httpApi)}constructor(httpApi){this.httpApi=httpApi}arnForExecuteApi(method,path,stage){if(path&&!core_1().Token.isUnresolved(path)&&!path.startsWith("/"))throw new(core_1()).ValidationError("PathStart",`Path must start with '/': ${path}`,this.httpApi);return method&&method.toUpperCase()==="ANY"&&(method="*"),core_1().Stack.of(this.httpApi).formatArn({service:"execute-api",account:this.httpApi.env.account,region:this.httpApi.env.region,resource:this.httpApi.apiRef.apiId,arnFormat:core_1().ArnFormat.SLASH_RESOURCE_NAME,resourceName:`${stage??"*"}/${method??"*"}${path??"/*"}`})}}exports.HttpApiHelper=HttpApiHelper;