-
Notifications
You must be signed in to change notification settings - Fork 4k
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-ec2): Add SubnetFilter for Id and CIDR netmask #15373
Conversation
constructor(mask: number) { | ||
super(); | ||
if (mask < 16 || mask > 28 ) { |
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.
Outsider comment: this check isn't necessary. The Subnet class should already prevent creation of a subnet that isn't like 28 >= cidr mask >= 16.
If AWS supports a different range of subnets in the future, this would need to update as well.
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.
Agreed. I think this check is redundant.
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 good!
All really minor stuff. The docs I think need an update; the two code changes are optional (but recommended).
constructor(mask: number) { | ||
super(); | ||
if (mask < 16 || mask > 28 ) { |
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.
Agreed. I think this check is redundant.
packages/@aws-cdk/aws-ec2/README.md
Outdated
* `SubnetIdSubnetFilter`: chooses subnets from a list of ids | ||
* `AvailabilityZoneSubnetFilter`: chooses subnets in the provided list of availability zones | ||
* `OnePerAZSubnetFilter`: chooses at most one subnet per availability zone | ||
* `ContainsIpAddressesSubnetFilter`: chooses a subnet which contains *any* of the listed ip addresses | ||
* `CidrMaskSubnetFilter`: chooses subnets that have the provided CIDR netmask |
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 is a good enhancement to the documentation. However, since the various classes are all private (not exported) it probably makes more sense to replace the class names here with the static factory method names.
} | ||
|
||
private retainByCidrMask(subnets: ISubnet[], netmask: number): ISubnet[] { |
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.
~
(Nit) I would probably just inline this; I don't know that making it its own method adds anything here.
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 changes!
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). |
This PR adds a couple of basic SubnetFilters into the CDK directly so they don't have to be needlessly reimplemented. The `SubnetIdSubnetFilter` filters subnets by ID and the `CidrMaskSubnetFilter` filters subnets based on the CIDR netmask. closes aws#15228 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR adds a couple of basic SubnetFilters into the CDK directly so they don't have to be needlessly reimplemented. The `SubnetIdSubnetFilter` filters subnets by ID and the `CidrMaskSubnetFilter` filters subnets based on the CIDR netmask. closes aws#15228 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR adds a couple of basic SubnetFilters into the CDK directly so they don't have to be needlessly reimplemented. The
SubnetIdSubnetFilter
filters subnets by ID and theCidrMaskSubnetFilter
filters subnets based on the CIDR netmask.closes #15228
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license