aws-cdk-lib.aws_appmesh.HttpGatewayRoutePathMatch

class HttpGatewayRoutePathMatch

LanguageType name
.NETAmazon.CDK.AWS.AppMesh.HttpGatewayRoutePathMatch
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsappmesh#HttpGatewayRoutePathMatch
Javasoftware.amazon.awscdk.services.appmesh.HttpGatewayRoutePathMatch
Pythonaws_cdk.aws_appmesh.HttpGatewayRoutePathMatch
TypeScript (source)aws-cdk-lib » 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

NameDescription
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 startsWith(prefix, rewriteTo?)The value of the path must match the specified prefix.

bind(scope)

public bind(scope: Construct): HttpGatewayRoutePathMatchConfig

Parameters

  • scope Construct

Returns

  • HttpGatewayRoutePathMatchConfig

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

  • HttpGatewayRoutePathMatch

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

  • HttpGatewayRoutePathMatch

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

  • HttpGatewayRoutePathMatch

The value of the path must match the specified prefix.