class HttpGatewayRoutePathMatch
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppMesh.HttpGatewayRoutePathMatch |
Java | software.amazon.awscdk.services.appmesh.HttpGatewayRoutePathMatch |
Python | aws_cdk.aws_appmesh.HttpGatewayRoutePathMatch |
TypeScript (source) | @aws-cdk/aws-appmesh » HttpGatewayRoutePathMatch |
Defines HTTP gateway route matching based on the URL path of the request.
Example
declare const gateway: appmesh.VirtualGateway;
declare const virtualService: appmesh.VirtualService;
gateway.addGatewayRoute('gateway-route-http-2', {
routeSpec: appmesh.GatewayRouteSpec.http({
routeTarget: virtualService,
match: {
// This rewrites the path from '/test' to '/rewrittenPath'.
path: appmesh.HttpGatewayRoutePathMatch.exactly('/test', '/rewrittenPath'),
},
}),
});
Initializer
new HttpGatewayRoutePathMatch()
Methods
Name | Description |
---|---|
bind(scope) | Returns the gateway route path match configuration. |
static exactly(path, rewriteTo?) | The value of the path must match the specified value exactly. |
static regex(regex, rewriteTo?) | The value of the path must match the specified regex. |
static starts | The value of the path must match the specified prefix. |
bind(scope)
public bind(scope: Construct): HttpGatewayRoutePathMatchConfig
Parameters
- scope
Construct
Returns
Returns the gateway route path match configuration.
static exactly(path, rewriteTo?)
public static exactly(path: string, rewriteTo?: string): HttpGatewayRoutePathMatch
Parameters
- path
string
— the exact path to match on. - rewriteTo
string
— the value to substitute for the matched part of the path of the gateway request URL As a default, retains original request's URL path.
Returns
The value of the path must match the specified value exactly.
The provided path
must start with the '/' character.
static regex(regex, rewriteTo?)
public static regex(regex: string, rewriteTo?: string): HttpGatewayRoutePathMatch
Parameters
- regex
string
— the regex used to match the path. - rewriteTo
string
— the value to substitute for the matched part of the path of the gateway request URL As a default, retains original request's URL path.
Returns
The value of the path must match the specified regex.
static startsWith(prefix, rewriteTo?)
public static startsWith(prefix: string, rewriteTo?: string): HttpGatewayRoutePathMatch
Parameters
- prefix
string
— the value to use to match the beginning of the path part of the URL of the request. - rewriteTo
string
— Specify either disabling automatic rewrite or rewriting to specified prefix path.
Returns
The value of the path must match the specified prefix.