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(aws-route53-targets): add global accelerator target to route53 alias targets #13407

Merged
merged 15 commits into from
Mar 5, 2021

Conversation

luketn
Copy link
Contributor

@luketn luketn commented Mar 4, 2021

Closes #12839

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 Mar 4, 2021

njlynch
njlynch previously requested changes Mar 5, 2021
Copy link
Contributor

@njlynch njlynch 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! 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) {
Copy link
Contributor

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:

  1. Typically we recommend using static methods instead (e.g., GlobalAcceleratorTarget.domain('xyz.awsglobalaccelerator.com'), GlobalAcceleratorTarget.accelerator(accelerator)).
  2. Within this package, it looks like maybe just creating a second class like ApiGateway/ApiGatewayDomain is an existing, alternative pattern. So you could create GlobalAcceleratorTarget and GlobalAcceleratorDomainTarget.
  3. Final alternative would be to just create this GlobalAcceleratorTarget that accepts an IAccelerator, and add the GlobalAcceleratorDomainTarget (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.

Copy link
Contributor Author

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.

@mergify mergify bot dismissed njlynch’s stale review March 5, 2021 13:44

Pull request has been modified.

Copy link
Contributor

@njlynch njlynch left a 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!

@mergify
Copy link
Contributor

mergify bot commented Mar 5, 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: f6fce6d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Mar 5, 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).

@mergify mergify bot merged commit 2672a55 into aws:master Mar 5, 2021
This was referenced Mar 8, 2021
cornerwings pushed a commit to cornerwings/aws-cdk that referenced this pull request Mar 8, 2021
…lias targets (aws#13407)

Closes aws#12839 
----

*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
@aws-cdk/aws-globalaccelerator Related to AWS Global Accelerator @aws-cdk/aws-route53-targets @aws-cdk/aws-route53 Related to Amazon Route 53
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-route53-targets: Add Global Accelerator target for Route53 alias
4 participants