-
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(location): support RouteCalculator #30682
Conversation
* | ||
* @default DataSource.ESRI | ||
*/ | ||
readonly dataSource?: DataSource; |
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.
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:
- https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-location-placeindex.html#cfn-location-placeindex-datasource
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-location-routecalculator.html#cfn-location-routecalculator-datasource
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...
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.
Agree. Let's see if the core team has a different opinion.
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 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?
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.
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.
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.
Thanks 👍 Left some comments for minor adjustments
* | ||
* @default DataSource.ESRI | ||
*/ | ||
readonly dataSource?: DataSource; |
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.
Agree. Let's see if the core team has a different opinion.
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
cd26ab7
to
7f12eec
Compare
@lpizzinidev |
…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*
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.
Generally LGTM, some minor feedbacks.
* | ||
* @default DataSource.ESRI | ||
*/ | ||
readonly dataSource?: DataSource; |
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 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 { |
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.
Same comment to another PR, don't think Base construct class is 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.
Thanks. I've removed base class.
|
||
const routeCalculator = new CfnRouteCalculator(this, 'Resource', { | ||
calculatorName: this.physicalName, | ||
dataSource: props.dataSource ?? DataSource.ESRI, |
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 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?
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 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.
ed060ab
to
5761669
Compare
@GavinZZ |
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.
LGTM, thank you!
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). |
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). |
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.
LGTM, appreciate all the effort into making this resource available!
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 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 main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
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