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(location): support RouteCalculator #30682

Merged
merged 19 commits into from
Aug 30, 2024

Conversation

mazyu36
Copy link
Contributor

@mazyu36 mazyu36 commented Jun 26, 2024

Issue # (if applicable)

Closes #30681 .

Reason for this change

In aws-location-alpha, route calculator has not been supported yet.

Description of changes

Add RouteCalculator class.

Description of how you validated changes

Add unit tests and integ tests.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the star-contributor [Pilot] contributed between 25-49 PRs to the CDK label Jun 26, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team June 26, 2024 16:21
@github-actions github-actions bot added feature-request A feature should be added or improved. p2 labels Jun 26, 2024
@mazyu36 mazyu36 marked this pull request as ready for review June 27, 2024 14:05
*
* @default DataSource.ESRI
*/
readonly dataSource?: DataSource;
Copy link
Contributor Author

@mazyu36 mazyu36 Jun 27, 2024

Choose a reason for hiding this comment

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

Currently, the DataSource for PlaceIndex and RouteCalculator are identical.
Therefore, I decided to reference the DataSource of PlaceIndex.
However, if there's a better approach, please share your opinion.

Ref:

I also considered defining a completely separate Enum like RouteDataSource, but decided against it as I thought it would be redundant.
I also thought about moving PlaceIndex's DataSource to a separate file, but I think it would result in breaking changes...

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree. Let's see if the core team has a different opinion.

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 in another PR of yours that you added a util file. I think it would be nice to move PlaceIndex's DataSource to somewhere more generic. Based on the CFN documentation, https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html, it seems that all these three resources should re-use the DataSource prop.

but I think it would result in breaking changes
I don't see why this would be a breaking change. Can you explain that to me please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I misunderstood the breaking change. Although I needed to fix unit test within the package, it doesn't actually affect the usage of the package.

I've moved the DataSource to the util module.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 27, 2024
This was referenced Jul 1, 2024
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks 👍 Left some comments for minor adjustments

*
* @default DataSource.ESRI
*/
readonly dataSource?: DataSource;
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree. Let's see if the core team has a different opinion.

packages/@aws-cdk/aws-location-alpha/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-location-alpha/README.md Outdated Show resolved Hide resolved
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 28, 2024
mazyu36 and others added 6 commits July 28, 2024 23:54
@mazyu36
Copy link
Contributor Author

mazyu36 commented Jul 29, 2024

@lpizzinidev
Thank you for approval !

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 29, 2024
mergify bot pushed a commit that referenced this pull request Jul 31, 2024
…x class (#30974)

### Issue # (if applicable)

N/A

### Reason for this change
Add validation for PlaceIndex description, similar to #30648, #30682, and #30711 .



### Description of changes
Add validation and unit tests for description.


### Description of how you validated changes
Add unit tests.


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

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

Generally LGTM, some minor feedbacks.

*
* @default DataSource.ESRI
*/
readonly dataSource?: DataSource;
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 in another PR of yours that you added a util file. I think it would be nice to move PlaceIndex's DataSource to somewhere more generic. Based on the CFN documentation, https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html, it seems that all these three resources should re-use the DataSource prop.

but I think it would result in breaking changes
I don't see why this would be a breaking change. Can you explain that to me please?

readonly description?: string;
}

abstract class RouteCalculatorBase extends Resource implements IRouteCalculator {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment to another PR, don't think Base construct class is needed.

Copy link
Contributor Author

@mazyu36 mazyu36 Aug 29, 2024

Choose a reason for hiding this comment

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

Thanks. I've removed base class.


const routeCalculator = new CfnRouteCalculator(this, 'Resource', {
calculatorName: this.physicalName,
dataSource: props.dataSource ?? DataSource.ESRI,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think CFN doc didn't specify a default value. I'm not familiar with this service/resource, can you briefly explain the reasoning of choosing ESRI as the default behaviour?

Copy link
Contributor Author

@mazyu36 mazyu36 Aug 29, 2024

Choose a reason for hiding this comment

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

I aligned it with the already implemented PlaceIndex class.
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-location-alpha/lib/place-index.ts#L42

However, since it's listed as a required item in the CFn documentation, I've adjusted it to match that.

I think the DataSource for PlaceIndex should also be required, but I haven't made that change this time.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Aug 28, 2024
@mergify mergify bot dismissed GavinZZ’s stale review August 29, 2024 06:57

Pull request has been modified.

@mazyu36 mazyu36 mentioned this pull request Aug 29, 2024
1 task
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Aug 29, 2024
@mazyu36
Copy link
Contributor Author

mazyu36 commented Aug 29, 2024

@GavinZZ
Thank you for the review. I've addressed all your comments.

@mazyu36 mazyu36 requested a review from GavinZZ August 29, 2024 09:31
GavinZZ
GavinZZ previously approved these changes Aug 29, 2024
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Contributor

mergify bot commented Aug 29, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Aug 29, 2024
Copy link
Contributor

mergify bot commented Aug 29, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed GavinZZ’s stale review August 29, 2024 22:23

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Aug 29, 2024
@mazyu36
Copy link
Contributor Author

mazyu36 commented Aug 29, 2024

@GavinZZ
Sorry, conflicts occurred due to the merge of #30711, so I resolved them.
Could you please review and approve again?

@mazyu36 mazyu36 requested a review from GavinZZ August 29, 2024 22:58
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

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

LGTM, appreciate all the effort into making this resource available!

Copy link
Contributor

mergify bot commented Aug 30, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Aug 30, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 10380f0
  • 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 574d383 into aws:main Aug 30, 2024
12 checks passed
Copy link
Contributor

mergify bot commented Aug 30, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2024
@mazyu36 mazyu36 deleted the location-route-calculator branch August 30, 2024 00:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request A feature should be added or improved. p2 star-contributor [Pilot] contributed between 25-49 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-location-alpha: support L2 Route Calculator Construct
4 participants