HttpRoutePathMatch

class aws_cdk.aws_appmesh.HttpRoutePathMatch

Bases: object

Defines HTTP route matching based on the URL path of the request.

ExampleMetadata:

infused

Example:

# router: appmesh.VirtualRouter
# node: appmesh.VirtualNode


router.add_route("route-http",
    route_spec=appmesh.RouteSpec.http(
        weighted_targets=[appmesh.WeightedTarget(
            virtual_node=node,
            weight=50
        ), appmesh.WeightedTarget(
            virtual_node=node,
            weight=50
        )
        ],
        match=appmesh.HttpRouteMatch(
            path=appmesh.HttpRoutePathMatch.starts_with("/path-to-app")
        )
    )
)

Methods

abstract bind(scope)

Returns the route path match configuration.

Parameters:

scope (Construct) –

Return type:

HttpRoutePathMatchConfig

Static Methods

classmethod exactly(path)

The value of the path must match the specified value exactly.

The provided path must start with the ‘/’ character.

Parameters:

path (str) – the exact path to match on.

Return type:

HttpRoutePathMatch

classmethod regex(regex)

The value of the path must match the specified regex.

Parameters:

regex (str) – the regex used to match the path.

Return type:

HttpRoutePathMatch

classmethod starts_with(prefix)

The value of the path must match the specified prefix.

Parameters:

prefix (str) – the value to use to match the beginning of the path part of the URL of the request. It must start with the ‘/’ character. If provided as “/”, matches all requests. For example, if your virtual service name is “my-service.local” and you want the route to match requests to “my-service.local/metrics”, your prefix should be “/metrics”.

Return type:

HttpRoutePathMatch