QueryParameterMatch Class
Used to generate query parameter matching methods.
| Source | aws-appmesh/lib/query-parameter-match.ts |
|---|
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')
],
},
}),
});
python
# 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")
]
)
)
)
java
VirtualRouter router;
VirtualNode node;
router.addRoute("route-http2", RouteBaseProps.builder()
.routeSpec(RouteSpec.http2(HttpRouteSpecOptions.builder()
.weightedTargets(List.of(WeightedTarget.builder()
.virtualNode(node)
.build()))
.match(HttpRouteMatch.builder()
.path(HttpRoutePathMatch.exactly("/exact"))
.method(HttpRouteMethod.POST)
.protocol(HttpRouteProtocol.HTTPS)
.headers(List.of(HeaderMatch.valueIs("Content-Type", "application/json"), HeaderMatch.valueIsNot("Content-Type", "application/json")))
.queryParameters(List.of(QueryParameterMatch.valueIs("query-field", "value")))
.build())
.build()))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
VirtualRouter router;
VirtualNode node;
router.AddRoute("route-http2", new RouteBaseProps {
RouteSpec = RouteSpec.Http2(new HttpRouteSpecOptions {
WeightedTargets = new [] { new WeightedTarget {
VirtualNode = node
} },
Match = new HttpRouteMatch {
Path = HttpRoutePathMatch.Exactly("/exact"),
Method = HttpRouteMethod.POST,
Protocol = HttpRouteProtocol.HTTPS,
Headers = new [] { HeaderMatch.ValueIs("Content-Type", "application/json"), HeaderMatch.ValueIsNot("Content-Type", "application/json") },
QueryParameters = new [] { QueryParameterMatch.ValueIs("query-field", "value") }
}
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var router VirtualRouter
var node VirtualNode
router.addRoute(jsii.String("route-http2"), &RouteBaseProps{
RouteSpec: appmesh.RouteSpec_Http2(&HttpRouteSpecOptions{
WeightedTargets: []WeightedTarget{
&WeightedTarget{
VirtualNode: node,
},
},
Match: &HttpRouteMatch{
Path: appmesh.HttpRoutePathMatch_Exactly(jsii.String("/exact")),
Method: appmesh.HttpRouteMethod_POST,
Protocol: appmesh.HttpRouteProtocol_HTTPS,
Headers: []HeaderMatch{
appmesh.HeaderMatch_ValueIs(jsii.String("Content-Type"), jsii.String("application/json")),
appmesh.HeaderMatch_ValueIsNot(jsii.String("Content-Type"), jsii.String("application/json")),
},
QueryParameters: []QueryParameterMatch{
appmesh.QueryParameterMatch_ValueIs(jsii.String("query-field"), jsii.String("value")),
},
},
}),
})
Initializer
ts
new QueryParameterMatch()
python
QueryParameterMatch()
java
new QueryParameterMatch()
csharp
new QueryParameterMatch()
go
NewQueryParameterMatch()
Methods
bind(scope: Construct): QueryParameterMatchConfigdef bind(self, scope: Construct) -> QueryParameterMatchConfigpublic QueryParameterMatchConfig bind(Construct scope)public QueryParameterMatchConfig Bind(Construct scope)func Bind(Scope Construct) QueryParameterMatchConfig #Returns the query parameter match configuration.
valueIs(queryParameterName: string, queryParameterValue: string): QueryParameterMatch // chainable@staticmethod def value_is(query_parameter_name: str, query_parameter_value: str) -> QueryParameterMatchpublic static QueryParameterMatch valueIs(String queryParameterName, String queryParameterValue)public static QueryParameterMatch ValueIs(string queryParameterName, string queryParameterValue)func ValueIs(QueryParameterName *string, QueryParameterValue *string) QueryParameterMatch static #The value of the query parameter with the given name in the request must match the specified value exactly.
2 parameters
Parameters
queryParameterNamequery_parameter_namequeryParameterNamequeryParameterNameQueryParameterName— the name of the query parameter to match against.queryParameterValuequery_parameter_valuequeryParameterValuequeryParameterValueQueryParameterValue— The exact value to test against.