Skip to content

Commit

Permalink
Merge branch 'main' into conroy/noticesrefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Dec 18, 2024
2 parents ac35f90 + c1d3130 commit b38cf58
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 45 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.173.2-alpha.0](https://github.com/aws/aws-cdk/compare/v2.173.1-alpha.0...v2.173.2-alpha.0) (2024-12-17)

## [2.173.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.173.0-alpha.0...v2.173.1-alpha.0) (2024-12-14)

## [2.173.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.172.0-alpha.0...v2.173.0-alpha.0) (2024-12-11)


Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.173.2](https://github.com/aws/aws-cdk/compare/v2.173.1...v2.173.2) (2024-12-17)


### Bug Fixes

* **cli:** allow credential plugins to return `null` for `expiration` ([#32554](https://github.com/aws/aws-cdk/issues/32554)) ([e59b1db](https://github.com/aws/aws-cdk/commit/e59b1db4d8da5fc11d0e3beeb136593440100325))
* **cli:** doesn't support plugins that return initially empty credentials ([#32552](https://github.com/aws/aws-cdk/issues/32552)) ([7ee9b90](https://github.com/aws/aws-cdk/commit/7ee9b909695aca317a11aad16ca983dcc6d6f85a))

## [2.173.1](https://github.com/aws/aws-cdk/compare/v2.173.0...v2.173.1) (2024-12-14)


### Bug Fixes

* **cli:** getting credentials via SSO fails when the region is set in the profile ([#32520](https://github.com/aws/aws-cdk/issues/32520)) ([01fec04](https://github.com/aws/aws-cdk/commit/01fec04ea8c0e33a406e6727801f8bc133a21196))

## [2.173.0](https://github.com/aws/aws-cdk/compare/v2.172.0...v2.173.0) (2024-12-11)


Expand Down
7 changes: 3 additions & 4 deletions packages/@aws-cdk/aws-ec2-alpha/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class CidrBlock {
}

/**
* Checks if two IP address ranges overlap.
* Checks if two IPv4 address ranges overlap.
*
* @param range1 The first IP address range represented as an array [start, end].
* @param range2 The second IP address range represented as an array [start, end].
Expand All @@ -269,9 +269,8 @@ export class CidrBlock {
* Note: This method assumes that the start and end addresses are valid IPv4 addresses.
*/
public rangesOverlap(range1: [string, string], range2: [string, string]): boolean {
const [start1, end1] = range1;
const [start2, end2] = range2;

const [start1, end1] = range1.map(ip => NetworkUtils.ipToNum(ip));
const [start2, end2] = range2.map(ip => NetworkUtils.ipToNum(ip));
// Check if ranges overlap
return start1 <= end2 && start2 <= end1;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"SubnetTest3296A161": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"CidrBlock": "10.1.0.0/16",
"EnableDnsHostnames": true,
"EnableDnsSupport": true,
"InstanceTenancy": "default"
Expand All @@ -26,7 +26,7 @@
"Properties": {
"AssignIpv6AddressOnCreation": false,
"AvailabilityZone": "us-west-2a",
"CidrBlock": "10.0.0.0/24",
"CidrBlock": "10.1.0.0/20",
"VpcId": {
"Fn::GetAtt": [
"SubnetTest3296A161",
Expand Down Expand Up @@ -221,7 +221,7 @@
"Properties": {
"AssignIpv6AddressOnCreation": false,
"AvailabilityZone": "us-west-2a",
"CidrBlock": "10.0.1.0/24",
"CidrBlock": "10.1.128.0/20",
"VpcId": {
"Fn::GetAtt": [
"SubnetTest3296A161",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const app = new cdk.App();
const stack = new cdk.Stack(app, 'aws-cdk-vpcv2-alpha-new');

const vpc = new vpc_v2.VpcV2(stack, 'SubnetTest', {
primaryAddressBlock: vpc_v2.IpAddresses.ipv4('10.0.0.0/16'),
primaryAddressBlock: vpc_v2.IpAddresses.ipv4('10.1.0.0/16'),
secondaryAddressBlocks: [vpc_v2.IpAddresses.amazonProvidedIpv6( {
cidrBlockName: 'SecondaryTest',
})],
Expand All @@ -36,7 +36,7 @@ const vpc = new vpc_v2.VpcV2(stack, 'SubnetTest', {
new SubnetV2(stack, 'testSubnet1', {
vpc,
availabilityZone: 'us-west-2a',
ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
ipv4CidrBlock: new IpCidr('10.1.0.0/20'),
//defined on the basis of allocation done in IPAM console
//ipv6CidrBlock: new Ipv6Cidr('2a05:d02c:25:4000::/60'),
subnetType: SubnetType.PRIVATE_ISOLATED,
Expand Down Expand Up @@ -64,7 +64,7 @@ routeTable.addRoute('eigwRoute', '0.0.0.0/0', { gateway: igw });
new SubnetV2(stack, 'testSubnet2', {
vpc,
availabilityZone: 'us-west-2a',
ipv4CidrBlock: new IpCidr('10.0.1.0/24'),
ipv4CidrBlock: new IpCidr('10.1.128.0/20'),
routeTable: routeTable,
subnetType: SubnetType.PUBLIC,
});
Expand Down
38 changes: 38 additions & 0 deletions packages/@aws-cdk/aws-ec2-alpha/test/util.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { CidrBlock } from '../lib/util';

describe('Tests for the CidrBlock.rangesOverlap method to check if IPv4 ranges overlap', () =>{
test('Should return false for non-overlapping IP ranges', () => {
const testCidr = new CidrBlock('10.0.0.0/16');
const range1 = ['10.0.0.0', '10.0.15.255'] as [string, string];
const range2 = ['10.0.128.0', '10.0.143.255'] as [string, string];
expect(testCidr.rangesOverlap(range1, range2)).toBe(false);
});

test('Should return true for overlapping IP ranges', () => {
const testCidr = new CidrBlock('54.0.0.0/17');
const range1 = ['54.0.0.0', '54.0.127.255'] as [string, string];
const range2 = ['54.0.100.0', '54.0.192.255'] as [string, string];
expect(testCidr.rangesOverlap(range1, range2)).toBe(true);
});

test('Should return true for overlapping IP ranges where one range is completely inside the other', () => {
const testCidr = new CidrBlock('10.0.0.0/16');
const range1 = ['10.0.0.0', '10.0.127.255'] as [string, string];
const range2 = ['10.0.64.0', '10.0.65.255'] as [string, string];
expect(testCidr.rangesOverlap(range1, range2)).toBe(true);
});

test('Should return true for overlapping IP ranges where the last IP of one range is the first IP of the other', () => {
const testCidr = new CidrBlock('10.0.0.0/16');
const range1 = ['10.0.0.0', '10.0.15.255'] as [string, string];
const range2 = ['10.0.15.255', '10.0.255.255'] as [string, string];
expect(testCidr.rangesOverlap(range1, range2)).toBe(true);
});

test('Should return false for non-overlapping IP ranges where one range starts immediately after the other ends', () => {
const testCidr = new CidrBlock('10.0.0.0/16');
const range1 = ['10.0.0.0', '10.0.15.255'] as [string, string];
const range2 = ['10.0.16.0', '10.0.19.255'] as [string, string];
expect(testCidr.rangesOverlap(range1, range2)).toBe(false);
});
});
Loading

0 comments on commit b38cf58

Please sign in to comment.