aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 3.6 kB
JavaScript
var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpGatewayRoutePathMatch=exports.HttpRoutePathMatch=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp};class HttpRoutePathMatch{static exactly(path){return new HttpRouteWholePathMatch({exact:path})}static regex(regex){return new HttpRouteWholePathMatch({regex})}static startsWith(prefix){return new HttpRoutePrefixPathMatch(prefix)}}exports.HttpRoutePathMatch=HttpRoutePathMatch,_a=JSII_RTTI_SYMBOL_1,HttpRoutePathMatch[_a]={fqn:"aws-cdk-lib.aws_appmesh.HttpRoutePathMatch",version:"2.202.0"};class HttpRoutePrefixPathMatch extends HttpRoutePathMatch{constructor(prefix){if(super(),this.prefix=prefix,prefix&&prefix[0]!=="/")throw new(errors_1()).UnscopedValidationError(`Prefix Path for the match must start with '/', got: ${prefix}`)}bind(_scope){return{prefixPathMatch:this.prefix}}}class HttpRouteWholePathMatch extends HttpRoutePathMatch{constructor(match){if(super(),this.match=match,match.exact&&match.exact[0]!=="/")throw new(errors_1()).UnscopedValidationError(`Exact Path for the match must start with '/', got: ${match.exact}`)}bind(_scope){return{wholePathMatch:this.match}}}class HttpGatewayRoutePathMatch{static startsWith(prefix,rewriteTo){return new HttpGatewayRoutePrefixPathMatch(prefix,rewriteTo)}static exactly(path,rewriteTo){return new HttpGatewayRouteWholePathMatch({exact:path},rewriteTo)}static regex(regex,rewriteTo){return new HttpGatewayRouteWholePathMatch({regex},rewriteTo)}}exports.HttpGatewayRoutePathMatch=HttpGatewayRoutePathMatch,_b=JSII_RTTI_SYMBOL_1,HttpGatewayRoutePathMatch[_b]={fqn:"aws-cdk-lib.aws_appmesh.HttpGatewayRoutePathMatch",version:"2.202.0"};class HttpGatewayRoutePrefixPathMatch extends HttpGatewayRoutePathMatch{constructor(prefixPathMatch,rewriteTo){if(super(),this.prefixPathMatch=prefixPathMatch,this.rewriteTo=rewriteTo,prefixPathMatch[0]!=="/")throw new(errors_1()).UnscopedValidationError(`Prefix path for the match must start with '/', got: ${prefixPathMatch}`);if(rewriteTo){if(prefixPathMatch[prefixPathMatch.length-1]!=="/")throw new(errors_1()).UnscopedValidationError(`When prefix path for the rewrite is specified, prefix path for the match must end with '/', got: ${prefixPathMatch}`);if(rewriteTo[0]!=="/"||rewriteTo[rewriteTo.length-1]!=="/")throw new(errors_1()).UnscopedValidationError(`Prefix path for the rewrite must start and end with '/', got: ${rewriteTo}`)}}bind(_scope){return{prefixPathMatch:this.prefixPathMatch,prefixPathRewrite:this.rewriteTo===void 0?void 0:{defaultPrefix:this.rewriteTo===""?"DISABLED":void 0,value:this.rewriteTo===""?void 0:this.rewriteTo}}}}class HttpGatewayRouteWholePathMatch extends HttpGatewayRoutePathMatch{constructor(wholePathMatch,exactPathRewrite){if(super(),this.wholePathMatch=wholePathMatch,this.exactPathRewrite=exactPathRewrite,wholePathMatch.exact&&wholePathMatch.exact[0]!=="/")throw new(errors_1()).UnscopedValidationError(`Exact Path for the match must start with '/', got: ${wholePathMatch.exact}`);if(exactPathRewrite==="")throw new(errors_1()).UnscopedValidationError("Exact Path for the rewrite cannot be empty. Unlike startsWith() method, no automatic rewrite on whole path match");if(exactPathRewrite&&exactPathRewrite[0]!=="/")throw new(errors_1()).UnscopedValidationError(`Exact Path for the rewrite must start with '/', got: ${exactPathRewrite}`)}bind(_scope){return{wholePathMatch:this.wholePathMatch,wholePathRewrite:this.exactPathRewrite===void 0?void 0:{exact:this.exactPathRewrite}}}}
;