mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(rds): support IPV6 and DUAL network types on RDS Proxy (#3639)
CreateDBProxy/AWS::RDS::DBProxy rejected EndpointNetworkType/TargetConnectionNetworkType
outright for anything other than IPV4 ("Floci currently exposes IPv4 proxy networking only").
Both fields are now accepted and stored on the DbProxy record:
- EndpointNetworkType: IPV4, IPV6, or DUAL
- TargetConnectionNetworkType: IPV4 or IPV6 (no DUAL, matching AWS's own constraint)
They round-trip through DescribeDBProxies and CloudFormation the same way the proxy's other
control-plane settings (pool sizing, TLS, idle timeout) already did.
AWS's RDS Proxy network prerequisites require both the VPC and every selected subnet to carry
an associated IPv6 CIDR block for IPV6/DUAL. floci already modeled VPC-level IPv6 CIDR
associations; subnet-level association is now modeled too (Subnet.ipv6CidrBlockAssociationSet,
CreateSubnet's Ipv6CidrBlock parameter, and the DescribeSubnets/CreateSubnet response), and
createDbProxy validates both the VPC and every VpcSubnetIds entry before accepting a non-IPV4
network type, rejecting with InvalidParameterValue otherwise. Genuinely invalid enum values are
still rejected at both the RDS Query API and CloudFormation provisioner layers.
The CloudFormation update path now also refuses a changed EndpointNetworkType or
TargetConnectionNetworkType the same way it already refused a changed DBProxyName, EngineFamily,
or VpcSubnetIds: both are createOnlyProperties in the AWS::RDS::DBProxy registry schema, and
ModifyDBProxy has no such parameters, so silently accepting a changed value on UpdateStack would
report UPDATE_COMPLETE while the proxy's actual network type stayed put.
Added a Terraform compatibility scenario (rds-proxy-network-type-tf) with a genuinely
dual-stack VPC and subnets, plus negative cases for an IPv4-only VPC and for a dual-stack VPC
whose subnets lack an IPv6 CIDR block.
This commit is contained in:
1 parent
315dfe69f0
commit
c7b4a393d9
14 files changed
+713
-66
No files matched your search
+27
-17
@@ -598,9 +598,9 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
String endpointNetworkType = resolveOptional(props, "EndpointNetworkType", engine);
|
||||
String targetConnectionNetworkType = resolveOptional(
|
||||
props, "TargetConnectionNetworkType", engine);
|
||||
validateIpv4DbProxyNetworkType(endpointNetworkType,
|
||||
validateDbProxyNetworkType(endpointNetworkType,
|
||||
"EndpointNetworkType", true, "IPV4, IPV6, or DUAL");
|
||||
validateIpv4DbProxyNetworkType(targetConnectionNetworkType,
|
||||
validateDbProxyNetworkType(targetConnectionNetworkType,
|
||||
"TargetConnectionNetworkType", false, "IPV4 or IPV6");
|
||||
boolean requireTls = parseBoolProp(props, "RequireTLS", engine);
|
||||
boolean debugLogging = parseBoolProp(props, "DebugLogging", engine);
|
||||
@@ -622,9 +622,10 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
var proxy = r.getPhysicalId() == null
|
||||
? rdsService.createDbProxy(name, engineFamily, requireTls, iamAuth,
|
||||
defaultAuthScheme, roleArn, subnetIds, sgIds, auth, idleClientTimeout,
|
||||
debugLogging, tags, region)
|
||||
debugLogging, tags, region, endpointNetworkType, targetConnectionNetworkType)
|
||||
: updateDbProxy(r, name, engineFamily, defaultAuthScheme, requireTls,
|
||||
idleClientTimeout, debugLogging, roleArn, subnetIds, sgIds, auth, tags, region);
|
||||
idleClientTimeout, debugLogging, roleArn, subnetIds, sgIds, auth, tags, region,
|
||||
endpointNetworkType, targetConnectionNetworkType);
|
||||
r.setPhysicalId(proxy.getDbProxyName()); // Ref -> DBProxyName
|
||||
r.getAttributes().put("Endpoint", proxy.getEndpoint()); // GetAtt "Endpoint" (bare host)
|
||||
r.getAttributes().put("DBProxyArn", proxy.getDbProxyArn());
|
||||
@@ -637,15 +638,31 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
StackResource resource, String name, String engineFamily, String defaultAuthScheme,
|
||||
boolean requireTls, int idleClientTimeout, boolean debugLogging, String roleArn,
|
||||
List<String> subnetIds, List<String> securityGroupIds, List<DbProxyAuth> auth,
|
||||
Map<String, String> tags, String region) {
|
||||
Map<String, String> tags, String region, String endpointNetworkType,
|
||||
String targetConnectionNetworkType) {
|
||||
var existing = rdsService.getDbProxy(resource.getPhysicalId(), region);
|
||||
// ModifyDBProxy has no EndpointNetworkType/TargetConnectionNetworkType parameters; AWS
|
||||
// documents both as requiring CloudFormation replacement, same as DBProxyName, EngineFamily,
|
||||
// and VpcSubnetIds.
|
||||
String effectiveEndpointNetworkType = endpointNetworkType != null && !endpointNetworkType.isBlank()
|
||||
? endpointNetworkType.toUpperCase() : "IPV4";
|
||||
String effectiveTargetConnectionNetworkType =
|
||||
targetConnectionNetworkType != null && !targetConnectionNetworkType.isBlank()
|
||||
? targetConnectionNetworkType.toUpperCase() : "IPV4";
|
||||
String existingEndpointNetworkType = existing.getEndpointNetworkType() != null
|
||||
? existing.getEndpointNetworkType() : "IPV4";
|
||||
String existingTargetConnectionNetworkType = existing.getTargetConnectionNetworkType() != null
|
||||
? existing.getTargetConnectionNetworkType() : "IPV4";
|
||||
if (!Objects.equals(existing.getDbProxyName(), name)
|
||||
|| engineFamily == null
|
||||
|| !existing.getEngineFamily().equalsIgnoreCase(engineFamily)
|
||||
|| !Set.copyOf(existing.getVpcSubnetIds()).equals(Set.copyOf(subnetIds))) {
|
||||
|| !Set.copyOf(existing.getVpcSubnetIds()).equals(Set.copyOf(subnetIds))
|
||||
|| !existingEndpointNetworkType.equalsIgnoreCase(effectiveEndpointNetworkType)
|
||||
|| !existingTargetConnectionNetworkType.equalsIgnoreCase(effectiveTargetConnectionNetworkType)) {
|
||||
throw new AwsException("UnsupportedOperation",
|
||||
"Changing DBProxyName, EngineFamily, or VpcSubnetIds requires CloudFormation "
|
||||
+ "replacement, which is not yet supported by Floci.", 400);
|
||||
"Changing DBProxyName, EngineFamily, VpcSubnetIds, EndpointNetworkType, or "
|
||||
+ "TargetConnectionNetworkType requires CloudFormation replacement, "
|
||||
+ "which is not yet supported by Floci.", 400);
|
||||
}
|
||||
return rdsService.modifyDbProxy(existing.getDbProxyName(), defaultAuthScheme, auth,
|
||||
requireTls, idleClientTimeout, debugLogging, roleArn,
|
||||
@@ -720,12 +737,9 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
return auth;
|
||||
}
|
||||
|
||||
private void validateIpv4DbProxyNetworkType(
|
||||
private void validateDbProxyNetworkType(
|
||||
String value, String propertyName, boolean dualAllowed, String validValues) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if ("IPV4".equalsIgnoreCase(value)) {
|
||||
if (value == null || "IPV4".equalsIgnoreCase(value)) {
|
||||
return;
|
||||
}
|
||||
boolean supportedAwsValue = "IPV6".equalsIgnoreCase(value)
|
||||
@@ -734,10 +748,6 @@ public class RdsCfnProvisioner implements CfnResourceProvisioner {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
propertyName + " must be " + validValues + ".", 400);
|
||||
}
|
||||
throw new AwsException("UnsupportedOperation",
|
||||
propertyName + " " + value.toUpperCase()
|
||||
+ " is not supported because Floci currently exposes IPv4 proxy networking only.",
|
||||
400);
|
||||
}
|
||||
|
||||
private void deleteDbProxySafe(String name, String region) {
|
||||
|
||||
@@ -2817,7 +2817,8 @@ public class Ec2QueryHandler {
|
||||
String cidrBlock = p.getFirst("CidrBlock");
|
||||
String az = p.getFirst("AvailabilityZone");
|
||||
String azId = p.getFirst("AvailabilityZoneId");
|
||||
Subnet subnet = service.createSubnet(region, vpcId, cidrBlock, az, azId);
|
||||
String ipv6CidrBlock = p.getFirst("Ipv6CidrBlock");
|
||||
Subnet subnet = service.createSubnet(region, vpcId, cidrBlock, az, azId, ipv6CidrBlock);
|
||||
applyResourceTags(p, region, "subnet", subnet.getSubnetId());
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.start("CreateSubnetResponse", AwsNamespaces.EC2)
|
||||
@@ -4491,12 +4492,26 @@ public class Ec2QueryHandler {
|
||||
.elem("assignIpv6AddressOnCreation", String.valueOf(s.isAssignIpv6AddressOnCreation()))
|
||||
.elem("enableDns64", String.valueOf(s.isEnableDns64()))
|
||||
.elem("mapCustomerOwnedIpOnLaunch", String.valueOf(s.isMapCustomerOwnedIpOnLaunch()))
|
||||
.start("ipv6CidrBlockAssociationSet").end("ipv6CidrBlockAssociationSet")
|
||||
.start("ipv6CidrBlockAssociationSet");
|
||||
for (VpcIpv6CidrBlockAssociation assoc : s.getIpv6CidrBlockAssociationSet()) {
|
||||
xml.start("item").raw(subnetIpv6AssociationXml(assoc)).end("item");
|
||||
}
|
||||
xml.end("ipv6CidrBlockAssociationSet")
|
||||
.elem("ownerId", s.getOwnerId())
|
||||
.raw(tagSetXml(s.getTags()));
|
||||
return xml.build();
|
||||
}
|
||||
|
||||
// Subnet's ipv6CidrBlockAssociationSet item carries only ipv6CidrBlock/associationId/state on
|
||||
// the wire, unlike the VPC's own association, which also carries ipv6Pool/networkBorderGroup.
|
||||
private String subnetIpv6AssociationXml(VpcIpv6CidrBlockAssociation assoc) {
|
||||
return new XmlBuilder()
|
||||
.elem("ipv6CidrBlock", assoc.getIpv6CidrBlock())
|
||||
.elem("associationId", assoc.getAssociationId())
|
||||
.start("ipv6CidrBlockState").elem("state", assoc.getIpv6CidrBlockState()).end("ipv6CidrBlockState")
|
||||
.build();
|
||||
}
|
||||
|
||||
private String sgXml(SecurityGroup sg) {
|
||||
XmlBuilder xml = new XmlBuilder()
|
||||
.elem("ownerId", sg.getOwnerId())
|
||||
|
||||
@@ -3456,6 +3456,11 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider {
|
||||
return new VpcIpv6CidrBlockAssociation("vpc-cidr-assoc-" + randomHex(8), block, region);
|
||||
}
|
||||
|
||||
private boolean vpcHasAssociatedIpv6CidrBlock(Vpc vpc) {
|
||||
return vpc.getIpv6CidrBlockAssociationSet().stream()
|
||||
.anyMatch(assoc -> "associated".equalsIgnoreCase(assoc.getIpv6CidrBlockState()));
|
||||
}
|
||||
|
||||
public void disassociateVpcCidrBlock(String region, String associationId) {
|
||||
ensureDefaultResources(region);
|
||||
for (Vpc vpc : vpcs.scan(k -> true)) {
|
||||
@@ -3852,11 +3857,21 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider {
|
||||
|
||||
public Subnet createSubnet(String region, String vpcId, String cidrBlock, String availabilityZone,
|
||||
String availabilityZoneId) {
|
||||
return createSubnet(region, vpcId, cidrBlock, availabilityZone, availabilityZoneId, null);
|
||||
}
|
||||
|
||||
public Subnet createSubnet(String region, String vpcId, String cidrBlock, String availabilityZone,
|
||||
String availabilityZoneId, String ipv6CidrBlock) {
|
||||
if (vpcId == null || vpcId.isBlank()) {
|
||||
throw new AwsException("MissingParameter", "The request must contain the parameter VpcId", 400);
|
||||
}
|
||||
ensureDefaultResources(region);
|
||||
getRequiredVpc(region, vpcId);
|
||||
Vpc vpc = getRequiredVpc(region, vpcId);
|
||||
if (ipv6CidrBlock != null && !ipv6CidrBlock.isBlank() && !vpcHasAssociatedIpv6CidrBlock(vpc)) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"Ipv6CidrBlock can only be specified for a subnet in a VPC with an associated "
|
||||
+ "IPv6 CIDR block. VPC " + vpcId + " has none.", 400);
|
||||
}
|
||||
|
||||
String zoneName = resolveSubnetZoneName(region, availabilityZone, availabilityZoneId);
|
||||
|
||||
@@ -3872,6 +3887,10 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider {
|
||||
subnet.setOwnerId(accountId);
|
||||
subnet.setRegion(region);
|
||||
subnet.setSubnetArn(AwsArnUtils.Arn.of("ec2", region, accountId, "subnet/" + subnetId).toString());
|
||||
if (ipv6CidrBlock != null && !ipv6CidrBlock.isBlank()) {
|
||||
subnet.getIpv6CidrBlockAssociationSet().add(new VpcIpv6CidrBlockAssociation(
|
||||
"subnet-cidr-assoc-" + randomHex(17), ipv6CidrBlock, null));
|
||||
}
|
||||
// The conflict scan and the store must be one step under the VPC's lock, or two
|
||||
// overlapping creates in flight together both pass the scan before either is stored.
|
||||
synchronized (lockFor(key(region, vpcId))) {
|
||||
|
||||
@@ -26,6 +26,7 @@ public class Subnet {
|
||||
private String region;
|
||||
private String subnetArn;
|
||||
private List<Tag> tags = new ArrayList<>();
|
||||
private List<VpcIpv6CidrBlockAssociation> ipv6CidrBlockAssociationSet = new ArrayList<>();
|
||||
|
||||
public Subnet() {}
|
||||
|
||||
@@ -76,4 +77,7 @@ public class Subnet {
|
||||
|
||||
public List<Tag> getTags() { return tags; }
|
||||
public void setTags(List<Tag> tags) { this.tags = tags; }
|
||||
|
||||
public List<VpcIpv6CidrBlockAssociation> getIpv6CidrBlockAssociationSet() { return ipv6CidrBlockAssociationSet; }
|
||||
public void setIpv6CidrBlockAssociationSet(List<VpcIpv6CidrBlockAssociation> ipv6CidrBlockAssociationSet) { this.ipv6CidrBlockAssociationSet = ipv6CidrBlockAssociationSet; }
|
||||
}
|
||||
@@ -1162,10 +1162,10 @@ public class RdsQueryHandler {
|
||||
}
|
||||
|
||||
private Response handleCreateDbProxy(MultivaluedMap<String, String> params, String region) {
|
||||
validateIpv4NetworkType(params.getFirst("EndpointNetworkType"),
|
||||
"EndpointNetworkType", true, "IPV4, IPV6, or DUAL");
|
||||
validateIpv4NetworkType(params.getFirst("TargetConnectionNetworkType"),
|
||||
"TargetConnectionNetworkType", false, "IPV4 or IPV6");
|
||||
String endpointNetworkType = params.getFirst("EndpointNetworkType");
|
||||
String targetConnectionNetworkType = params.getFirst("TargetConnectionNetworkType");
|
||||
validateDbProxyNetworkType(endpointNetworkType, "EndpointNetworkType", true, "IPV4, IPV6, or DUAL");
|
||||
validateDbProxyNetworkType(targetConnectionNetworkType, "TargetConnectionNetworkType", false, "IPV4 or IPV6");
|
||||
String name = params.getFirst("DBProxyName");
|
||||
String engineFamily = params.getFirst("EngineFamily");
|
||||
boolean requireTls = "true".equalsIgnoreCase(params.getFirst("RequireTLS"));
|
||||
@@ -1190,7 +1190,8 @@ public class RdsQueryHandler {
|
||||
iamEnabled = iamEnabled || "IAM_AUTH".equalsIgnoreCase(defaultAuthScheme);
|
||||
DbProxy proxy = service.createDbProxy(
|
||||
name, engineFamily, requireTls, iamEnabled, defaultAuthScheme, roleArn,
|
||||
subnetIds, sgIds, auth, idleClientTimeout, debugLogging, parseTags(params), region);
|
||||
subnetIds, sgIds, auth, idleClientTimeout, debugLogging, parseTags(params), region,
|
||||
endpointNetworkType, targetConnectionNetworkType);
|
||||
String result = new XmlBuilder().start("DBProxy").raw(dbProxyInnerXml(proxy)).end("DBProxy").build();
|
||||
return Response.ok(AwsQueryResponse.envelope("CreateDBProxy", AwsNamespaces.RDS, result)).build();
|
||||
}
|
||||
@@ -1378,12 +1379,9 @@ public class RdsQueryHandler {
|
||||
return xml.build();
|
||||
}
|
||||
|
||||
private static void validateIpv4NetworkType(
|
||||
private static void validateDbProxyNetworkType(
|
||||
String value, String parameterName, boolean dualAllowed, String validValues) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if ("IPV4".equalsIgnoreCase(value)) {
|
||||
if (value == null || "IPV4".equalsIgnoreCase(value)) {
|
||||
return;
|
||||
}
|
||||
boolean supportedAwsValue = "IPV6".equalsIgnoreCase(value)
|
||||
@@ -1392,10 +1390,6 @@ public class RdsQueryHandler {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
parameterName + " must be " + validValues + ".", 400);
|
||||
}
|
||||
throw new AwsException("UnsupportedOperation",
|
||||
parameterName + " " + value.toUpperCase()
|
||||
+ " is not supported because Floci currently exposes IPv4 proxy networking only.",
|
||||
400);
|
||||
}
|
||||
|
||||
private String dbProxyTargetGroupInnerXml(DbProxyTargetGroup tg) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import io.github.hectorvent.floci.core.storage.StorageBackend;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
import io.github.hectorvent.floci.services.ec2.Ec2Service;
|
||||
import io.github.hectorvent.floci.services.ec2.model.Subnet;
|
||||
import io.github.hectorvent.floci.services.ec2.model.Vpc;
|
||||
import io.github.hectorvent.floci.services.rds.container.RdsContainerHandle;
|
||||
import io.github.hectorvent.floci.services.rds.container.RdsContainerManager;
|
||||
import io.github.hectorvent.floci.services.rds.model.DatabaseEngine;
|
||||
@@ -2491,17 +2492,33 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
vpcSubnetIds, vpcSecurityGroupIds, auth, idleClientTimeout, debugLogging, tags, region);
|
||||
}
|
||||
|
||||
public DbProxy createDbProxy(String dbProxyName, String engineFamily, boolean requireTls,
|
||||
boolean iamAuth, String defaultAuthScheme, String roleArn,
|
||||
List<String> vpcSubnetIds,
|
||||
List<String> vpcSecurityGroupIds, List<DbProxyAuth> auth,
|
||||
int idleClientTimeout, boolean debugLogging,
|
||||
Map<String, String> tags, String region) {
|
||||
return createDbProxy(dbProxyName, engineFamily, requireTls, iamAuth, defaultAuthScheme, roleArn,
|
||||
vpcSubnetIds, vpcSecurityGroupIds, auth, idleClientTimeout, debugLogging, tags, region,
|
||||
null, null);
|
||||
}
|
||||
|
||||
public synchronized DbProxy createDbProxy(String dbProxyName, String engineFamily, boolean requireTls,
|
||||
boolean iamAuth, String defaultAuthScheme, String roleArn,
|
||||
List<String> vpcSubnetIds,
|
||||
List<String> vpcSecurityGroupIds, List<DbProxyAuth> auth,
|
||||
int idleClientTimeout, boolean debugLogging,
|
||||
Map<String, String> tags, String region) {
|
||||
Map<String, String> tags, String region,
|
||||
String endpointNetworkType, String targetConnectionNetworkType) {
|
||||
String effectiveDefaultAuthScheme = normalizeDefaultAuthScheme(defaultAuthScheme);
|
||||
validateDbProxyCreate(dbProxyName, engineFamily, roleArn, vpcSubnetIds, auth,
|
||||
effectiveDefaultAuthScheme, idleClientTimeout);
|
||||
String effectiveRegion = effectiveRegion(region);
|
||||
String vpcId = resolveDbProxyVpc(vpcSubnetIds, effectiveRegion);
|
||||
if (requiresIpv6VpcCidrBlock(endpointNetworkType, targetConnectionNetworkType)) {
|
||||
validateVpcHasIpv6CidrBlock(vpcId, effectiveRegion);
|
||||
validateSubnetsHaveIpv6CidrBlock(vpcSubnetIds, effectiveRegion);
|
||||
}
|
||||
String proxyKey = dbProxyKey(effectiveRegion, dbProxyName);
|
||||
String accountId = currentAccountId();
|
||||
if (findDbProxy(dbProxyName, effectiveRegion).isPresent()
|
||||
@@ -2529,6 +2546,12 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
proxy.setAuth(auth);
|
||||
proxy.setIdleClientTimeout(idleClientTimeout);
|
||||
proxy.setDebugLogging(debugLogging);
|
||||
if (endpointNetworkType != null && !endpointNetworkType.isBlank()) {
|
||||
proxy.setEndpointNetworkType(endpointNetworkType.toUpperCase());
|
||||
}
|
||||
if (targetConnectionNetworkType != null && !targetConnectionNetworkType.isBlank()) {
|
||||
proxy.setTargetConnectionNetworkType(targetConnectionNetworkType.toUpperCase());
|
||||
}
|
||||
proxy.setTags(tags);
|
||||
proxy.setProxyPort(proxyPort);
|
||||
proxy.setEndpointHost(mock ? "localhost" : proxyEndpointHost());
|
||||
@@ -6010,6 +6033,39 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
return vpcIds.iterator().next();
|
||||
}
|
||||
|
||||
private boolean requiresIpv6VpcCidrBlock(String endpointNetworkType, String targetConnectionNetworkType) {
|
||||
return "IPV6".equalsIgnoreCase(endpointNetworkType) || "DUAL".equalsIgnoreCase(endpointNetworkType)
|
||||
|| "IPV6".equalsIgnoreCase(targetConnectionNetworkType);
|
||||
}
|
||||
|
||||
private void validateVpcHasIpv6CidrBlock(String vpcId, String region) {
|
||||
List<Vpc> vpcs = ec2Service.describeVpcs(region, List.of(vpcId), Map.of());
|
||||
boolean hasIpv6 = !vpcs.isEmpty() && vpcs.get(0).getIpv6CidrBlockAssociationSet().stream()
|
||||
.anyMatch(assoc -> "associated".equalsIgnoreCase(assoc.getIpv6CidrBlockState()));
|
||||
if (!hasIpv6) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"EndpointNetworkType/TargetConnectionNetworkType of IPV6 or DUAL requires VPC "
|
||||
+ vpcId + " to have an associated IPv6 CIDR block.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
// AWS requires every selected subnet, not just the VPC, to carry an associated IPv6 CIDR block
|
||||
// for an IPV6/DUAL proxy endpoint: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-network-prereqs.html
|
||||
private void validateSubnetsHaveIpv6CidrBlock(List<String> subnetIds, String region) {
|
||||
List<Subnet> subnets = ec2Service.describeSubnets(region, subnetIds, Map.of());
|
||||
List<String> missing = subnets.stream()
|
||||
.filter(subnet -> subnet.getIpv6CidrBlockAssociationSet().stream()
|
||||
.noneMatch(assoc -> "associated".equalsIgnoreCase(assoc.getIpv6CidrBlockState())))
|
||||
.map(Subnet::getSubnetId)
|
||||
.toList();
|
||||
if (!missing.isEmpty()) {
|
||||
throw new AwsException("InvalidParameterValue",
|
||||
"EndpointNetworkType/TargetConnectionNetworkType of IPV6 or DUAL requires every "
|
||||
+ "VpcSubnetIds entry to have an associated IPv6 CIDR block; missing on "
|
||||
+ missing + ".", 400);
|
||||
}
|
||||
}
|
||||
|
||||
private DbSubnetGroup buildSubnetGroup(String name, String description, List<String> subnetIds, String region) {
|
||||
List<Subnet> resolvedSubnets = ec2Service.describeSubnets(region, subnetIds, Map.of());
|
||||
if (resolvedSubnets.size() != subnetIds.size()) {
|
||||
|
||||
Reference in new issue
Block a user