aws-cdk-lib.aws_appmesh.HeaderMatch

class HeaderMatch

LanguageType name
.NETAmazon.CDK.AWS.AppMesh.HeaderMatch
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsappmesh#HeaderMatch
Javasoftware.amazon.awscdk.services.appmesh.HeaderMatch
Pythonaws_cdk.aws_appmesh.HeaderMatch
TypeScript (source)aws-cdk-lib » aws_appmesh » HeaderMatch

Used to generate header matching methods.

Example

declare const router: appmesh.VirtualRouter;
declare const node: appmesh.VirtualNode;

router.addRoute('route-http2', {
  routeSpec: appmesh.RouteSpec.http2({
    weightedTargets: [
      {
        virtualNode: node,
      },
    ],
    match: {
      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.valueIs('Content-Type', 'application/json'),
        appmesh.HeaderMatch.valueIsNot('Content-Type', 'application/json'),
      ],
      queryParameters: [
        // All specified query parameters must match for the route to match.
        appmesh.QueryParameterMatch.valueIs('query-field', 'value')
      ],
    },
  }),
});

Initializer

new HeaderMatch()

Methods

NameDescription
bind(scope)Returns the header match configuration.
static valueDoesNotEndWith(headerName, suffix)The value of the header with the given name in the request must not end with the specified characters.
static valueDoesNotMatchRegex(headerName, regex)The value of the header with the given name in the request must not include the specified characters.
static valueDoesNotStartWith(headerName, prefix)The value of the header with the given name in the request must not start with the specified characters.
static valueEndsWith(headerName, suffix)The value of the header with the given name in the request must end with the specified characters.
static valueIs(headerName, headerValue)The value of the header with the given name in the request must match the specified value exactly.
static valueIsNot(headerName, headerValue)The value of the header with the given name in the request must not match the specified value exactly.
static valueMatchesRegex(headerName, regex)The value of the header with the given name in the request must include the specified characters.
static valueStartsWith(headerName, prefix)The value of the header with the given name in the request must start with the specified characters.
static valuesIsInRange(headerName, start, end)The value of the header with the given name in the request must be in a range of values.
static valuesIsNotInRange(headerName, start, end)The value of the header with the given name in the request must not be in a range of values.

bind(scope)

public bind(scope: Construct): HeaderMatchConfig

Parameters

  • scope Construct

Returns

  • HeaderMatchConfig

Returns the header match configuration.


static valueDoesNotEndWith(headerName, suffix)

public static valueDoesNotEndWith(headerName: string, suffix: string): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • suffix string — The suffix to test against.

Returns

  • HeaderMatch

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


static valueDoesNotMatchRegex(headerName, regex)

public static valueDoesNotMatchRegex(headerName: string, regex: string): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • regex string — The regex to test against.

Returns

  • HeaderMatch

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


static valueDoesNotStartWith(headerName, prefix)

public static valueDoesNotStartWith(headerName: string, prefix: string): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • prefix string — The prefix to test against.

Returns

  • HeaderMatch

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


static valueEndsWith(headerName, suffix)

public static valueEndsWith(headerName: string, suffix: string): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • suffix string — The suffix to test against.

Returns

  • HeaderMatch

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


static valueIs(headerName, headerValue)

public static valueIs(headerName: string, headerValue: string): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • headerValue string — The exact value to test against.

Returns

  • HeaderMatch

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


static valueIsNot(headerName, headerValue)

public static valueIsNot(headerName: string, headerValue: string): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • headerValue string — The exact value to test against.

Returns

  • HeaderMatch

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


static valueMatchesRegex(headerName, regex)

public static valueMatchesRegex(headerName: string, regex: string): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • regex string — The regex to test against.

Returns

  • HeaderMatch

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


static valueStartsWith(headerName, prefix)

public static valueStartsWith(headerName: string, prefix: string): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • prefix string — The prefix to test against.

Returns

  • HeaderMatch

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


static valuesIsInRange(headerName, start, end)

public static valuesIsInRange(headerName: string, start: number, end: number): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • start number — Match on values starting at and including this value.
  • end number — Match on values up to but not including this value.

Returns

  • HeaderMatch

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


static valuesIsNotInRange(headerName, start, end)

public static valuesIsNotInRange(headerName: string, start: number, end: number): HeaderMatch

Parameters

  • headerName string — the name of the header to match against.
  • start number — Match on values starting at and including this value.
  • end number — Match on values up to but not including this value.

Returns

  • HeaderMatch

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