-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(appmesh): add Route matching on path, query parameters, metadata, and method name #15470
Conversation
Title does not follow the guidelines of Conventional Commits. Please adjust title before merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, looks great! A few suggestion that I believe will greatly simplify this code.
match: { | ||
prefix: prefixPath, | ||
prefix: prefixPathMatch, | ||
path: wholePathMatch, | ||
headers: headers?.map(header => header.bind(scope).headerMatch), | ||
method: this.match?.method, | ||
scheme: this.match?.protocol, | ||
queryParameters: queryParameters?.map(queryParameter => queryParameter.bind(scope).queryParameterMatch), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an idea: let's leave match
as undefined
if either this.match
is undefined
, or if all of its properties are undefined
.
So, this would be:
match: { | |
prefix: prefixPath, | |
prefix: prefixPathMatch, | |
path: wholePathMatch, | |
headers: headers?.map(header => header.bind(scope).headerMatch), | |
method: this.match?.method, | |
scheme: this.match?.protocol, | |
queryParameters: queryParameters?.map(queryParameter => queryParameter.bind(scope).queryParameterMatch), | |
}, | |
match: allPropertiesAreUndefined(this.match) ? undefined : { | |
prefix: pathMatchConfig.prefixPathMatch, | |
path: pathMatchConfig.wholePathMatch, | |
headers: headers?.map(header => header.bind(scope).headerMatch), | |
method: this.match?.method, | |
scheme: this.match?.protocol, | |
queryParameters: queryParameters?.map(queryParameter => queryParameter.bind(scope).queryParameterMatch), | |
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually match
is the required property so would not be able to set undefined
.
In addition, we set prefix
to /
if neither prefix
and path
are defined so we are guaranteed to have at least one property be defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see all of the properties of the CfnGatewayRoute.HttpGatewayRouteMatchProperty
are opitonal.
Is there some CloudFormation validation that errors out if an empty object is passed as its value, or is it legal to just omit all of the properties? Because if it's legal, let's just do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some CloudFormation validation that errors out if an empty object is passed as its value
Yes, CloudFormation has a validation to prohibit passing empty value or empty array.
is it legal to just omit all of the properties
No, CloudFormation also validates if least one type of match is specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since CDK has a validation to check empty array and non-array property accepts an object so I believe CDK-side has all validation that are needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @Seiya6329! Just a few finishing touches, and this will be ready for merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @Seiya6329!
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
@skinny85 - Thank you very much for making the change on the last suggestions! |
…, and method name (aws#15470) Adding new match properties for `Route`. - For HTTP match, adding `path` and `queryParameters`. Remove `prefixPath`. - For gRPC match, adding `metadata` and `method name` BREAKING CHANGE: `prefixPath` property in `HttpRouteMatch` has been renamed to `path`, and its type changed from `string` to `HttpRoutePathMatch` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…, and method name (aws#15470) Adding new match properties for `Route`. - For HTTP match, adding `path` and `queryParameters`. Remove `prefixPath`. - For gRPC match, adding `metadata` and `method name` BREAKING CHANGE: `prefixPath` property in `HttpRouteMatch` has been renamed to `path`, and its type changed from `string` to `HttpRoutePathMatch` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Adding new match properties for
Route
.path
andqueryParameters
. RemoveprefixPath
.metadata
andmethod name
BREAKING CHANGE:
prefixPath
property inHttpRouteMatch
has been renamed topath
, and its type changed fromstring
toHttpRoutePathMatch
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license