fix(rds): restrict custom endpoint mutations to Aurora (#5206)

* fix(rds): restrict cluster endpoints to Aurora

* fix(rds): preserve legacy cluster endpoints

* fix(rds): align cluster endpoint restrictions
This commit is contained in:
Aniket Shukla authored and GitHub committed 2026-10-07 09:52:42 -04:00
1 parent 9d49e619c1
commit d8b170a144
2 files changed
+48

No files matched your search

@@ -9339,6 +9339,7 @@ public class RdsService implements Resettable, ResourceProvider {
}
String id = requireClusterEndpointIdentifier(endpointId);
DbCluster cluster = getDbCluster(clusterId, effectiveRegion);
requireAuroraCluster(cluster);
if (cluster.getStatus() != null && cluster.getStatus() != DbInstanceStatus.AVAILABLE) {
throw new AwsException("InvalidDBClusterStateFault",
"DB cluster " + cluster.getDbClusterIdentifier() + " is not in available state.", 400);
@@ -9385,6 +9386,7 @@ public class RdsService implements Resettable, ResourceProvider {
String effectiveRegion = effectiveRegion(region);
DbClusterEndpoint endpoint = requireClusterEndpoint(effectiveRegion, endpointId);
DbCluster cluster = getDbCluster(endpoint.getDbClusterIdentifier(), effectiveRegion);
requireAuroraCluster(cluster);
String customType = isBlank(endpointType) ? endpoint.getCustomEndpointType() : requireCustomEndpointType(endpointType);
boolean listsGiven = staticMembers != null || excludedMembers != null;
List<String> newStatic = listsGiven ? clusterMembersNamed(cluster, staticMembers) : endpoint.getStaticMembers();
@@ -9467,6 +9469,13 @@ public class RdsService implements Resettable, ResourceProvider {
to < matching.size() ? Integer.toString(to) : null);
}
private static void requireAuroraCluster(DbCluster cluster) {
if (!isAuroraEngine(cluster.getEngineIdentifier())) {
throw new AwsException("InvalidParameterValue",
"Custom endpoints are supported only for Aurora DB clusters.", 400);
}
}
private static boolean matchesFilter(Map<String, List<String>> filters, String name, String value) {
List<String> wanted = filters != null ? filters.get(name) : null;
if (wanted == null || wanted.isEmpty()) {