class HeaderMatch
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.AppMesh.HeaderMatch |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsappmesh#HeaderMatch |
Java | software.amazon.awscdk.services.appmesh.HeaderMatch |
Python | aws_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
Name | Description |
---|---|
bind(scope) | Returns the header match configuration. |
static value | The value of the header with the given name in the request must not end with the specified characters. |
static value | The value of the header with the given name in the request must not include the specified characters. |
static value | The value of the header with the given name in the request must not start with the specified characters. |
static value | The value of the header with the given name in the request must end with the specified characters. |
static value | The value of the header with the given name in the request must match the specified value exactly. |
static value | The value of the header with the given name in the request must not match the specified value exactly. |
static value | The value of the header with the given name in the request must include the specified characters. |
static value | The value of the header with the given name in the request must start with the specified characters. |
static values | The value of the header with the given name in the request must be in a range of values. |
static values | 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
Returns the header match configuration.
DoesNotEndWith(headerName, suffix)
static valuepublic 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
The value of the header with the given name in the request must not end with the specified characters.
DoesNotMatchRegex(headerName, regex)
static valuepublic 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
The value of the header with the given name in the request must not include the specified characters.
DoesNotStartWith(headerName, prefix)
static valuepublic 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
The value of the header with the given name in the request must not start with the specified characters.
EndsWith(headerName, suffix)
static valuepublic 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
The value of the header with the given name in the request must end with the specified characters.
Is(headerName, headerValue)
static valuepublic 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
The value of the header with the given name in the request must match the specified value exactly.
IsNot(headerName, headerValue)
static valuepublic 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
The value of the header with the given name in the request must not match the specified value exactly.
MatchesRegex(headerName, regex)
static valuepublic 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
The value of the header with the given name in the request must include the specified characters.
StartsWith(headerName, prefix)
static valuepublic 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
The value of the header with the given name in the request must start with the specified characters.
IsInRange(headerName, start, end)
static valuespublic 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
The value of the header with the given name in the request must be in a range of values.
IsNotInRange(headerName, start, end)
static valuespublic 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
The value of the header with the given name in the request must not be in a range of values.