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(apigatewayv2): domain endpoint type, security policy and endpoint migration #17518

Merged
merged 9 commits into from
Nov 22, 2021

Conversation

SmritiVashisth
Copy link
Contributor

Updating the L2 construct for AWS::ApiGatewayV2::DomainName resource to add support for DomainNameConfigurations.
DomainNameConfigurations is a list of configurations for an API's domain name (CFN equivalent - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-domainname-domainnameconfiguration.html) which includes endpoint type, security policy, ownership certificate.

Changes include:

  • Code update to support the properties mentioned above
  • Unit test changes for existing tests to account for the updated domainNameConfigurations Lazy evaluation.
  • New unit tests for mutual tls with ownership certificate, and domain name migration that were not present before.

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 Nov 15, 2021

@github-actions github-actions bot added the @aws-cdk/aws-apigatewayv2 Related to Amazon API Gateway v2 label Nov 15, 2021
@SmritiVashisth SmritiVashisth changed the title feat(apigatwewayv2): add support for domain name configurations feat(apigatewayv2): add support for domain name configurations Nov 15, 2021
Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Wow. This looks much better. Good job on turning this PR around!

Some comments below.

packages/@aws-cdk/aws-apigatewayv2/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-apigatewayv2/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-apigatewayv2/README.md Outdated Show resolved Hide resolved
@nija-at nija-at changed the title feat(apigatewayv2): add support for domain name configurations feat(apigatewayv2): http api - domain endpoint type, security policy and endpoint migration Nov 16, 2021
@mergify mergify bot dismissed nija-at’s stale review November 16, 2021 21:06

Pull request has been modified.

Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Just a few comments here.

Please address comments from previous iteration around naming the method and validations.

packages/@aws-cdk/aws-apigatewayv2/README.md Outdated Show resolved Hide resolved
@mergify mergify bot dismissed nija-at’s stale review November 17, 2021 17:40

Pull request has been modified.

Comment on lines 221 to 228
private isDuplicateEndpointType(endpointType: string | undefined) : boolean {
for (let config of this.domainNameConfigurations) {
if (endpointType && endpointType == config.endpointType) {
return true;
}
}
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm reading this correctly, this will allow one endpoint type undefined and one endpoint type of REGIONAL. But this should not be allowed, right?

Can you fix this up and add a corresponding test case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It won't be that way. If you look at the addEndpoint() method which is the caller for this method, if there is no EndpointType defined by the customer, we set a default 'REGIONAL' endpoint. So this value will never be undefined. Some eslint code-check complained about it though, that's why I had to add undefined in the parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can check the last test I have added. When I call dn.addEndpoint(), I am not giving an EndpointType in the input, but the code still figures out that I'm trying to add a REGIONAL endpoint here and throws an error.

@mergify mergify bot dismissed nija-at’s stale review November 19, 2021 18:06

Pull request has been modified.

@nija-at nija-at changed the title feat(apigatewayv2): http api - domain endpoint type, security policy and endpoint migration feat(apigatewayv2): domain endpoint type, security policy and endpoint migration Nov 22, 2021
Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Fantastic. Thanks for all the work here! 👏

@mergify
Copy link
Contributor

mergify bot commented Nov 22, 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: e577a22
  • 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 261b331 into aws:master Nov 22, 2021
@mergify
Copy link
Contributor

mergify bot commented Nov 22, 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).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
…t migration (aws#17518)

Updating the L2 construct for `AWS::ApiGatewayV2::DomainName` resource to add support for DomainNameConfigurations.
DomainNameConfigurations is a list of configurations for an API's domain name (CFN equivalent - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigatewayv2-domainname-domainnameconfiguration.html) which includes endpoint type, security policy, ownership certificate.

Changes include:
- Code update to support the properties mentioned above
- Unit test changes for existing tests to account for the updated `domainNameConfigurations` Lazy evaluation. 
- New unit tests for mutual tls with ownership certificate, and domain name migration that were not present before.

----

*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-apigatewayv2 Related to Amazon API Gateway v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants