-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(route53): add cidrRoutingConfig property #34301
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
Conversation
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.
Thank you for your quick response. I've added some comments and I'll approve this later.
new IntegTest(app, 'CidrRoutingConfigInteg', { | ||
testCases: [stack], | ||
}); | ||
app.synth(); |
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.
You don't need this line.
|
||
```ts | ||
declare const zone: route53.HostedZone; | ||
|
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.
Could you please add a example of default cidr config??
if (!Token.isUnresolved(props.collectionId) && !COLLECTION_ID_REGEX.test(props.collectionId)) { | ||
throw new UnscopedValidationError(`collectionId(${props.collectionId}) is required and must be a valid UUID in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx(8-4-4-4-12 digits)`); | ||
} | ||
if (!props.locationName || !LOCATION_NAME_REGEX.test(props.locationName)) { |
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.
Please take care of the case that location name is a token.
/** | ||
* The object that is specified in resource record set object when you are linking a resource record set to a CIDR location. | ||
* | ||
* A LocationName with an asterisk “*” can be used to create a default CIDR record. CollectionId is still required for default record. |
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.
This line is not needed now by adding default factory method.
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 this line is needed. There are 2 reasons:
- The official documentation for AWS::Route53::RecordSet CidrRoutingConfig includes this explanation.
- While the
default
method now correctly setslocationName
to*
, I think it would be helpful to explicitly write this requirement for default CIDR records. How do you think?
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.
Thank you for addressing my comments. This is the final request.
if (!Token.isUnresolved(props.collectionId) && !COLLECTION_ID_REGEX.test(props.collectionId)) { | ||
throw new UnscopedValidationError(`collectionId(${props.collectionId}) is required and must be a valid UUID in the format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx(8-4-4-4-12 digits)`); | ||
} | ||
if (!Token.isUnresolved(props.locationName) && !props.locationName || !LOCATION_NAME_REGEX.test(props.locationName)) { |
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 regex validation must be executed only when token is resolved.
if (!Token.isUnresolved(props.locationName) && !props.locationName || !LOCATION_NAME_REGEX.test(props.locationName)) { | |
if (!Token.isUnresolved(props.locationName) && (!props.locationName || !LOCATION_NAME_REGEX.test(props.locationName))) { |
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.
accepted your suggestion and updated unit test.
43a8858
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!
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 for your contribution @tttol
I don't see any big blocker but I would like some clarifications (see my other comments). Thank you.
/** | ||
* Creates a new instance of CidrRoutingConfig | ||
*/ | ||
public static new(props: CidrRoutingConfigProps): CidrRoutingConfig { |
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 wouldn't use new
for that method name, especially since it is a commonly used keyword. I would much prefer something like create
if we really want to use a static factory strategy.
public static new(props: CidrRoutingConfigProps): CidrRoutingConfig { | |
public static create(props: CidrRoutingConfigProps): CidrRoutingConfig { |
*/ | ||
readonly locationName: string; | ||
|
||
private constructor(props: CidrRoutingConfigProps) { |
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 am curious why you are making this constructor private to enforce the utilization of the static factory methods?
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 private constructor has several benefits:
- It centralizes instance creation logic ensuring that all objects are constructed in a consistent and controlled manner.
- It allows for the implementation of specialized static methods, such as
withDefaultLocationName
In addition, I followed the approach used in the GeoLocation
class (a property of RecordSetOptions
), which also uses a private constructor.
private constructor(readonly continentCode: Continent | undefined, readonly countryCode: string | undefined,
readonly subdivisionCode: string | undefined) {
/** | ||
* The CIDR collection location name. | ||
*/ | ||
readonly locationName: string; |
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.
If you mark it as optional, you would be able to default it to '*'
, right?
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.
Yes, we can default it to '*'
if it's optional. I have updated locationName
to be an optional property.
/**
* The CIDR collection location name.
*/
readonly locationName?: string;
Co-authored-by: CORBIERE Sebastien <[email protected]>
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 for addressing all my comments and your contribution :)
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). |
This pull request has been removed from the queue for the following reason: The pull request can't be updated. You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
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)
N/A
Reason for this change
The L2 construct of Route 53 resource record set did not have a property
cidrRoutingConfig
. It was always necessary to set this prop via the L1 Construct when configuring IP-based routing.Description of changes
cidrRoutingConfig
toRecordSetProps
RecordSet
constructorDescribe any new or updated permissions being added
None
Description of how you validated changes
I added new unit test and integration test.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license