HeaderMatch

class aws_cdk.aws_appmesh.HeaderMatch

Bases: object

Used to generate header matching methods.

ExampleMetadata:

infused

Example:

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


router.add_route("route-http2",
    route_spec=appmesh.RouteSpec.http2(
        weighted_targets=[appmesh.WeightedTarget(
            virtual_node=node
        )
        ],
        match=appmesh.HttpRouteMatch(
            path=appmesh.HttpRoutePathMatch.exactly("/exact"),
            method=appmesh.HttpRouteMethod.POST,
            protocol=appmesh.HttpRouteProtocol.HTTPS,
            headers=[
                # All specified headers must match for the route to match.
                appmesh.HeaderMatch.value_is("Content-Type", "application/json"),
                appmesh.HeaderMatch.value_is_not("Content-Type", "application/json")
            ],
            query_parameters=[
                # All specified query parameters must match for the route to match.
                appmesh.QueryParameterMatch.value_is("query-field", "value")
            ]
        )
    )
)

Methods

abstract bind(scope)

Returns the header match configuration.

Parameters:

scope (Construct) –

Return type:

HeaderMatchConfig

Static Methods

classmethod value_does_not_end_with(header_name, suffix)

The value of the header with the given name in the request must not end with the specified characters.

Parameters:
  • header_name (str) – the name of the header to match against.

  • suffix (str) – The suffix to test against.

Return type:

HeaderMatch

classmethod value_does_not_match_regex(header_name, regex)

The value of the header with the given name in the request must not include the specified characters.

Parameters:
  • header_name (str) – the name of the header to match against.

  • regex (str) – The regex to test against.

Return type:

HeaderMatch

classmethod value_does_not_start_with(header_name, prefix)

The value of the header with the given name in the request must not start with the specified characters.

Parameters:
  • header_name (str) – the name of the header to match against.

  • prefix (str) – The prefix to test against.

Return type:

HeaderMatch

classmethod value_ends_with(header_name, suffix)

The value of the header with the given name in the request must end with the specified characters.

Parameters:
  • header_name (str) – the name of the header to match against.

  • suffix (str) – The suffix to test against.

Return type:

HeaderMatch

classmethod value_is(header_name, header_value)

The value of the header with the given name in the request must match the specified value exactly.

Parameters:
  • header_name (str) – the name of the header to match against.

  • header_value (str) – The exact value to test against.

Return type:

HeaderMatch

classmethod value_is_not(header_name, header_value)

The value of the header with the given name in the request must not match the specified value exactly.

Parameters:
  • header_name (str) – the name of the header to match against.

  • header_value (str) – The exact value to test against.

Return type:

HeaderMatch

classmethod value_matches_regex(header_name, regex)

The value of the header with the given name in the request must include the specified characters.

Parameters:
  • header_name (str) – the name of the header to match against.

  • regex (str) – The regex to test against.

Return type:

HeaderMatch

classmethod value_starts_with(header_name, prefix)

The value of the header with the given name in the request must start with the specified characters.

Parameters:
  • header_name (str) – the name of the header to match against.

  • prefix (str) – The prefix to test against.

Return type:

HeaderMatch

classmethod values_is_in_range(header_name, start, end)

The value of the header with the given name in the request must be in a range of values.

Parameters:
  • header_name (str) – the name of the header to match against.

  • start (Union[int, float]) – Match on values starting at and including this value.

  • end (Union[int, float]) – Match on values up to but not including this value.

Return type:

HeaderMatch

classmethod values_is_not_in_range(header_name, start, end)

The value of the header with the given name in the request must not be in a range of values.

Parameters:
  • header_name (str) – the name of the header to match against.

  • start (Union[int, float]) – Match on values starting at and including this value.

  • end (Union[int, float]) – Match on values up to but not including this value.

Return type:

HeaderMatch