@@ -138,7 +138,7 @@ export interface AllocateCidrRequest {
138
138
}
139
139
140
140
/**
141
- * Request for subnet IPv6 CIDRs to be allocated for a VPC
141
+ * Request for subnet IPv6 CIDRs to be allocated for a VPC.
142
142
*/
143
143
export interface AllocateIpv6CidrRequest {
144
144
/**
@@ -152,6 +152,27 @@ export interface AllocateIpv6CidrRequest {
152
152
readonly ipv6Cidrs : string [ ] ;
153
153
}
154
154
155
+ /**
156
+ * Request for IPv6 CIDR block to be split up.
157
+ */
158
+ export interface CreateIpv6CidrBlocksRequest {
159
+ /**
160
+ * The IPv6 CIDR block string representation.
161
+ */
162
+ readonly ipv6SelectedCidr : string ,
163
+
164
+ /**
165
+ * The number of subnets to assign CIDRs to.
166
+ */
167
+ readonly subnetCount : number ,
168
+
169
+ /**
170
+ * Size of the covered bits in the CIDR.
171
+ * @default - 128 - 64 = /64 CIDR.
172
+ */
173
+ readonly sizeMask ?: string ,
174
+ }
175
+
155
176
/**
156
177
* CIDR Allocated Subnets
157
178
*/
@@ -421,6 +442,13 @@ export interface IIpv6Addresses {
421
442
* Note this is specific to the IPv6 CIDR.
422
443
*/
423
444
allocateSubnetsIpv6Cidr ( input : AllocateIpv6CidrRequest ) : SubnetIpamOptions ;
445
+
446
+ /**
447
+ * Split IPv6 CIDR block up for subnets.
448
+ *
449
+ * Note this is specific to the IPv6 CIDR.
450
+ */
451
+ createIpv6CidrBlocks ( input : CreateIpv6CidrBlocksRequest ) : string [ ] ;
424
452
}
425
453
426
454
/**
@@ -461,4 +489,17 @@ class AmazonProvided implements IIpv6Addresses {
461
489
allocatedSubnets : allocatedSubnets ,
462
490
} ;
463
491
}
492
+
493
+ /**
494
+ * Split IPv6 CIDR block up for subnets.
495
+ *
496
+ * Called by VPC when creating subnets with IPv6 enabled.
497
+ *
498
+ * Note this is specific to the IPv6 CIDR.
499
+ */
500
+ createIpv6CidrBlocks ( input : CreateIpv6CidrBlocksRequest ) : string [ ] {
501
+ const sizeMask = input . sizeMask ?? '64' ; // 128 - 64
502
+
503
+ return Fn . cidr ( input . ipv6SelectedCidr , input . subnetCount , sizeMask ) ;
504
+ }
464
505
}
0 commit comments