Skip to content

Conversation

@mina-asham
Copy link
Contributor

@mina-asham mina-asham commented Apr 14, 2020

Commit Message

feat(cloudfront): support geo restrictions for cloudfront distribution (#7345)

End Commit Message

Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • (N/A)CLI change?: coordinate update of integration tests with team
    • (N/A)cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
    • (N/A)Design: For significant features, design document added to design folder
  • Title and Description
    • Change type: title prefixed with fix, feat and module name in parens, which will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • (N/A)Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • (N/A)[ ] Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 01c4d6e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 4b03b6a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: cd6f4e1
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 5c6b2a1
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@iliapolo iliapolo left a comment

Choose a reason for hiding this comment

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

Hi @mina-asham.

The PR looks good. However, I believe we can offer a slightly higher level experience.
Notice that the API you implemented is actually very similar to the native CloudFormation spec (and hence to the L1 construct).

Since we are building an L2, we should strive to simplify the usage, and not necessarily just expose CloudFormation properties as is. For example, what if the usage would have been something like:

new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', {
   
    //...
   
    geoRestriction: GeoRestriction.whitelist('UK', 'US')
});

This feels a bit more clear, less nesting and less code on the user's part.

What do you think?

@iliapolo iliapolo added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label May 6, 2020
@iliapolo
Copy link
Contributor

iliapolo commented May 6, 2020

@mina-asham Also - did you intentionally reference #6414 in the PR body?

@mina-asham
Copy link
Contributor Author

@mina-asham Also - did you intentionally reference #6414 in the PR body?

Nope, I don't recall putting that there, sorry for the mix up will drop it!

@mina-asham
Copy link
Contributor Author

Hi @mina-asham.

The PR looks good. However, I believe we can offer a slightly higher level experience.
Notice that the API you implemented is actually very similar to the native CloudFormation spec (and hence to the L1 construct).

Since we are building an L2, we should strive to simplify the usage, and not necessarily just expose CloudFormation properties as is. For example, what if the usage would have been something like:

new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', {
   
    //...
   
    geoRestriction: GeoRestriction.whitelist('UK', 'US')
});

This feels a bit more clear, less nesting and less code on the user's part.

What do you think?

I like that, it's much more intuitive to use this way indeed, will update!

@mina-asham
Copy link
Contributor Author

@iliapolo updated per comments!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: cc05988
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label May 6, 2020
- Restrictions currently support GeoRestriction only, but if CloudFront adds support for other types it can easily be expanded
- Closes #3456
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: df942e3
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 983fa6b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 4eeb5b9
  • 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 May 7, 2020

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 cf25ba0 into aws:master May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for GeoRestrictions in CloudFrontWebDistribution

3 participants