Skip to content
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

Merged
merged 10 commits into from
Jul 13, 2021

Conversation

Seiya6329
Copy link
Contributor

@Seiya6329 Seiya6329 commented Jul 9, 2021

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

@gitpod-io
Copy link

gitpod-io bot commented Jul 9, 2021

@mergify
Copy link
Contributor

mergify bot commented Jul 9, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@Seiya6329 Seiya6329 changed the title feature(appmesh): adding path, query parameter, metadata, and method name match properties feat(appmesh): adding path, query parameter, metadata, and method name match properties Jul 9, 2021
@Seiya6329 Seiya6329 changed the title feat(appmesh): adding path, query parameter, metadata, and method name match properties feat(appmesh): adding path, query parameter, metadata, and method name match properties to Route Jul 9, 2021
Copy link
Contributor

@skinny85 skinny85 left a 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.

packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/private/utils.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/route-spec.ts Outdated Show resolved Hide resolved
Comment on lines 466 to 473
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),
},
Copy link
Contributor

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:

Suggested change
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),
},

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

packages/@aws-cdk/aws-appmesh/lib/private/utils.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed skinny85’s stale review July 11, 2021 01:09

Pull request has been modified.

@Seiya6329 Seiya6329 requested a review from skinny85 July 11, 2021 01:10
Copy link
Contributor

@skinny85 skinny85 left a 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.

packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/private/utils.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/route-spec.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/route-spec.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed skinny85’s stale review July 12, 2021 23:40

Pull request has been modified.

@Seiya6329 Seiya6329 requested a review from skinny85 July 12, 2021 23:41
@skinny85 skinny85 added the pr/do-not-merge This PR should not be merged at this time. label Jul 13, 2021
skinny85
skinny85 previously approved these changes Jul 13, 2021
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @Seiya6329!

packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/route-spec.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed skinny85’s stale review July 13, 2021 00:25

Pull request has been modified.

@skinny85 skinny85 changed the title feat(appmesh): adding path, query parameter, metadata, and method name match properties to Route feat(appmesh): add Route matching on path, query parameters, metadata, and method name Jul 13, 2021
@skinny85 skinny85 removed the pr/do-not-merge This PR should not be merged at this time. label Jul 13, 2021
@mergify
Copy link
Contributor

mergify bot commented Jul 13, 2021

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 8a5e924
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit eeeec5d into aws:master Jul 13, 2021
@mergify
Copy link
Contributor

mergify bot commented Jul 13, 2021

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).

@Seiya6329
Copy link
Contributor Author

@skinny85 - Thank you very much for making the change on the last suggestions!

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Aug 3, 2021
…, 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*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…, 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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants