-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(aws-route53-targets): add global accelerator target to route53 alias targets #13407
Conversation
…ndividual classes for consistency with the rest of the codebase. Add documentation to the class.
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! Just one change necessary, due to the fact we can't fully support union types in the CDK.
* If passing a string value, it must be a valid domain name for an existing Global Accelerator. e.g. xyz.awsglobalaccelerator.com | ||
* If passing an instance of an accelerator created within CDK, the accelerator.dnsName property will be used as the target. | ||
*/ | ||
constructor(private readonly accelerator: string | globalaccelerator.IAccelerator) { |
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.
Unfortunately, we can't use type unions in our public APIs as they cannot be strongly-modeled in all languages the CDK supports.
Solutions:
- Typically we recommend using static methods instead (e.g.,
GlobalAcceleratorTarget.domain('xyz.awsglobalaccelerator.com')
,GlobalAcceleratorTarget.accelerator(accelerator)
). - Within this package, it looks like maybe just creating a second class like
ApiGateway
/ApiGatewayDomain
is an existing, alternative pattern. So you could createGlobalAcceleratorTarget
andGlobalAcceleratorDomainTarget
. - Final alternative would be to just create this
GlobalAcceleratorTarget
that accepts anIAccelerator
, and add theGlobalAcceleratorDomainTarget
(that takes the domain name/string) later based on feedback from the community.
I think given the existing patterns in this module options 2 or 3 are the principal of least surprise; I'm happy either way.
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.
Went with option 2. I think it actually makes the code a little cleaner, although it might not be as intuitive to locate and use.
packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.ts
Show resolved
Hide resolved
…ate classes for the GlobalAcceleratorTarget
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 the contribution!
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). |
Closes #12839
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license