Skip to content

Commit

Permalink
re-arrange ip-addresses functions
Browse files Browse the repository at this point in the history
  • Loading branch information
scanlonp committed Jan 11, 2024
1 parent f16843c commit 795fbc2
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions packages/aws-cdk-lib/aws-ec2/lib/ip-addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,6 @@ export interface AllocateCidrRequest {
readonly requestedSubnets: RequestedSubnet[];
}

/**
* Request for subnet IPv6 CIDRs to be allocated for a VPC.
*/
export interface AllocateIpv6CidrRequest {
/**
* List of subnets allocated with IPv4 CIDRs
*/
readonly allocatedSubnets: AllocatedSubnet[];

/**
* The IPv6 CIDRs to be allocated to the subnets
*/
readonly ipv6Cidrs: string[];
}

/**
* Request for IPv6 CIDR block to be split up.
*/
Expand All @@ -173,6 +158,21 @@ export interface CreateIpv6CidrBlocksRequest {
readonly sizeMask?: string,
}

/**
* Request for subnet IPv6 CIDRs to be allocated for a VPC.
*/
export interface AllocateIpv6CidrRequest {
/**
* List of subnets allocated with IPv4 CIDRs
*/
readonly allocatedSubnets: AllocatedSubnet[];

/**
* The IPv6 CIDRs to be allocated to the subnets
*/
readonly ipv6Cidrs: string[];
}

/**
* CIDR Allocated Subnets
*/
Expand Down Expand Up @@ -437,18 +437,18 @@ export interface IIpv6Addresses {
amazonProvided: boolean,

/**
* Allocates Subnets IPv6 CIDRs. Called by VPC when creating subnets with IPv6 enabled.
* Split IPv6 CIDR block up for subnets.
*
* Note this is specific to the IPv6 CIDR.
*/
allocateSubnetsIpv6Cidr(input: AllocateIpv6CidrRequest): SubnetIpamOptions;
createIpv6CidrBlocks(input: CreateIpv6CidrBlocksRequest): string[];

/**
* Split IPv6 CIDR block up for subnets.
* Allocates Subnets IPv6 CIDRs. Called by VPC when creating subnets with IPv6 enabled.
*
* Note this is specific to the IPv6 CIDR.
*/
createIpv6CidrBlocks(input: CreateIpv6CidrBlocksRequest): string[];
allocateSubnetsIpv6Cidr(input: AllocateIpv6CidrRequest): SubnetIpamOptions;
}

/**
Expand All @@ -466,6 +466,19 @@ class AmazonProvided implements IIpv6Addresses {
this.amazonProvided = true;
}

/**
* Split IPv6 CIDR block up for subnets.
*
* Called by VPC when creating subnets with IPv6 enabled.
*
* Note this is specific to the IPv6 CIDR.
*/
createIpv6CidrBlocks(input: CreateIpv6CidrBlocksRequest): string[] {
const sizeMask = input.sizeMask ?? '64'; // 128 - 64

return Fn.cidr(input.ipv6SelectedCidr, input.subnetCount, sizeMask);
}

/**
* Allocates Subnets IPv6 CIDRs. Called by VPC when creating subnets with IPv6 enabled.
*
Expand All @@ -489,17 +502,4 @@ class AmazonProvided implements IIpv6Addresses {
allocatedSubnets: allocatedSubnets,
};
}

/**
* Split IPv6 CIDR block up for subnets.
*
* Called by VPC when creating subnets with IPv6 enabled.
*
* Note this is specific to the IPv6 CIDR.
*/
createIpv6CidrBlocks(input: CreateIpv6CidrBlocksRequest): string[] {
const sizeMask = input.sizeMask ?? '64'; // 128 - 64

return Fn.cidr(input.ipv6SelectedCidr, input.subnetCount, sizeMask);
}
}

0 comments on commit 795fbc2

Please sign in to comment.