Skip to content
v2.274.0

HeaderMatch Class ​

Used to generate header matching methods.

Example ​

ts
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 ​

ts
new HeaderMatch()
python
HeaderMatch()
java
new HeaderMatch()
csharp
new HeaderMatch()
go
NewHeaderMatch()

Methods ​

bind(scope: Construct): HeaderMatchConfigdef bind(self, scope: Construct) -> HeaderMatchConfigpublic HeaderMatchConfig bind(Construct scope)public HeaderMatchConfig Bind(Construct scope)func Bind(Scope Construct) HeaderMatchConfig#
Returns the header match configuration.
valueDoesNotEndWith(headerName: string, suffix: string): HeaderMatch // chainable@staticmethod def value_does_not_end_with(header_name: str, suffix: str) -> HeaderMatchpublic static HeaderMatch valueDoesNotEndWith(String headerName, String suffix)public static HeaderMatch ValueDoesNotEndWith(string headerName, string suffix)func ValueDoesNotEndWith(HeaderName *string, Suffix *string) HeaderMatchstatic#
The value of the header with the given name in the request must not end with the specified characters.
2 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • suffixsuffixsuffixsuffixSuffix — The suffix to test against.
valueDoesNotMatchRegex(headerName: string, regex: string): HeaderMatch // chainable@staticmethod def value_does_not_match_regex(header_name: str, regex: str) -> HeaderMatchpublic static HeaderMatch valueDoesNotMatchRegex(String headerName, String regex)public static HeaderMatch ValueDoesNotMatchRegex(string headerName, string regex)func ValueDoesNotMatchRegex(HeaderName *string, Regex *string) HeaderMatchstatic#
The value of the header with the given name in the request must not include the specified characters.
2 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • regexregexregexregexRegex — The regex to test against.
valueDoesNotStartWith(headerName: string, prefix: string): HeaderMatch // chainable@staticmethod def value_does_not_start_with(header_name: str, prefix: str) -> HeaderMatchpublic static HeaderMatch valueDoesNotStartWith(String headerName, String prefix)public static HeaderMatch ValueDoesNotStartWith(string headerName, string prefix)func ValueDoesNotStartWith(HeaderName *string, Prefix *string) HeaderMatchstatic#
The value of the header with the given name in the request must not start with the specified characters.
2 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • prefixprefixprefixprefixPrefix — The prefix to test against.
valueEndsWith(headerName: string, suffix: string): HeaderMatch // chainable@staticmethod def value_ends_with(header_name: str, suffix: str) -> HeaderMatchpublic static HeaderMatch valueEndsWith(String headerName, String suffix)public static HeaderMatch ValueEndsWith(string headerName, string suffix)func ValueEndsWith(HeaderName *string, Suffix *string) HeaderMatchstatic#
The value of the header with the given name in the request must end with the specified characters.
2 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • suffixsuffixsuffixsuffixSuffix — The suffix to test against.
valueIs(headerName: string, headerValue: string): HeaderMatch // chainable@staticmethod def value_is(header_name: str, header_value: str) -> HeaderMatchpublic static HeaderMatch valueIs(String headerName, String headerValue)public static HeaderMatch ValueIs(string headerName, string headerValue)func ValueIs(HeaderName *string, HeaderValue *string) HeaderMatchstatic#
The value of the header with the given name in the request must match the specified value exactly.
2 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • headerValueheader_valueheaderValueheaderValueHeaderValue — The exact value to test against.
valueIsNot(headerName: string, headerValue: string): HeaderMatch // chainable@staticmethod def value_is_not(header_name: str, header_value: str) -> HeaderMatchpublic static HeaderMatch valueIsNot(String headerName, String headerValue)public static HeaderMatch ValueIsNot(string headerName, string headerValue)func ValueIsNot(HeaderName *string, HeaderValue *string) HeaderMatchstatic#
The value of the header with the given name in the request must not match the specified value exactly.
2 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • headerValueheader_valueheaderValueheaderValueHeaderValue — The exact value to test against.
valueMatchesRegex(headerName: string, regex: string): HeaderMatch // chainable@staticmethod def value_matches_regex(header_name: str, regex: str) -> HeaderMatchpublic static HeaderMatch valueMatchesRegex(String headerName, String regex)public static HeaderMatch ValueMatchesRegex(string headerName, string regex)func ValueMatchesRegex(HeaderName *string, Regex *string) HeaderMatchstatic#
The value of the header with the given name in the request must include the specified characters.
2 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • regexregexregexregexRegex — The regex to test against.
valuesIsInRange(headerName: string, start: number, end: number): HeaderMatch // chainable@staticmethod def values_is_in_range(header_name: str, start: int | float, end: int | float) -> HeaderMatchpublic static HeaderMatch valuesIsInRange(String headerName, Number start, Number end)public static HeaderMatch ValuesIsInRange(string headerName, double start, double end)func ValuesIsInRange(HeaderName *string, Start *float64, End *float64) HeaderMatchstatic#
The value of the header with the given name in the request must be in a range of values.
3 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • startstartstartstartStart — Match on values starting at and including this value.
  • endendendendEnd — Match on values up to but not including this value.
valuesIsNotInRange(headerName: string, start: number, end: number): HeaderMatch // chainable@staticmethod def values_is_not_in_range(header_name: str, start: int | float, end: int | float) -> HeaderMatchpublic static HeaderMatch valuesIsNotInRange(String headerName, Number start, Number end)public static HeaderMatch ValuesIsNotInRange(string headerName, double start, double end)func ValuesIsNotInRange(HeaderName *string, Start *float64, End *float64) HeaderMatchstatic#
The value of the header with the given name in the request must not be in a range of values.
3 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • startstartstartstartStart — Match on values starting at and including this value.
  • endendendendEnd — Match on values up to but not including this value.
valueStartsWith(headerName: string, prefix: string): HeaderMatch // chainable@staticmethod def value_starts_with(header_name: str, prefix: str) -> HeaderMatchpublic static HeaderMatch valueStartsWith(String headerName, String prefix)public static HeaderMatch ValueStartsWith(string headerName, string prefix)func ValueStartsWith(HeaderName *string, Prefix *string) HeaderMatchstatic#
The value of the header with the given name in the request must start with the specified characters.
2 parameters

Parameters

  • headerNameheader_nameheaderNameheaderNameHeaderName — the name of the header to match against.
  • prefixprefixprefixprefixPrefix — The prefix to test against.