From 16b0b516a0fc3bc9f179bc89dd0c7c1aeed892cf Mon Sep 17 00:00:00 2001 From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:41:03 -0400 Subject: [PATCH] fix(rds): accept a ModifyDBSnapshot that names nothing to change (#8633) ModifyDBSnapshot refused a request naming neither EngineVersion nor OptionGroupName with InvalidParameterCombination, "At least one snapshot attribute must be specified.", a message AWS does not use. The model requires only DBSnapshotIdentifier, and neither the API reference nor the User Guide's snapshot upgrade pages tie any error to a request with nothing to change, so such a request now returns the snapshot unchanged. A missing snapshot and one that is not available are still refused as before. The RDS docs record this as Floci's reading of an undocumented case. Closes #4083 --- .../com/floci/test/RdsControlPlaneTest.java | 2 ++ docs/services/rds.md | 6 +++-- .../io/floci/aws/services/rds/RdsService.java | 5 ---- .../aws/services/rds/RdsServiceTest.java | 25 ++++++++++++++++--- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsControlPlaneTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsControlPlaneTest.java index 96662434e9..79c07d8f17 100644 --- a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsControlPlaneTest.java +++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/RdsControlPlaneTest.java @@ -628,6 +628,8 @@ class RdsControlPlaneTest { .engineVersion("16.4")) .dbSnapshot(); assertThat(modified.engineVersion()).isEqualTo("16.4"); + DBSnapshot unchanged = rds.modifyDBSnapshot(b -> b.dbSnapshotIdentifier(snapshotName)).dbSnapshot(); + assertThat(unchanged.engineVersion()).isEqualTo("16.4"); DBSnapshot deleted = rds.deleteDBSnapshot(b -> b.dbSnapshotIdentifier(snapshotName)).dbSnapshot(); assertThat(deleted.status()).isEqualTo("deleted"); diff --git a/docs/services/rds.md b/docs/services/rds.md index 764f447566..8c04905ad0 100644 --- a/docs/services/rds.md +++ b/docs/services/rds.md @@ -208,8 +208,10 @@ checked against the instance's other window. Modifications apply immediately — `DescribeDBSnapshotAttributes`/`ModifyDBSnapshotAttribute` are modeled as plain in-memory state (no real cross-account sharing). Available manual snapshots can be deleted, copied by identifier or ARN, and modified. Copies retain the source data and can copy source tags or add - request tags. Snapshots are region-scoped like DB instances and clusters: `DBSnapshotArn` reflects - the request's signed region, and a snapshot is only visible to `Describe`/`Tag` calls signed + request tags. AWS doesn't document a `ModifyDBSnapshot` that names neither `EngineVersion` nor + `OptionGroupName`; Floci returns the snapshot unchanged, since the model requires only the + identifier and declares no fault for a request with nothing to change. Snapshots are + region-scoped like DB instances and clusters: `DBSnapshotArn` reflects the request's signed region, and a snapshot is only visible to `Describe`/`Tag` calls signed for that same region. Cluster snapshots follow the same lifecycle: `CreateDBClusterSnapshot` dumps the cluster's database, `RestoreDBClusterFromSnapshot` loads it into a new cluster, and `Copy`, `Delete` and the `restore` attribute behave as they do for instance snapshots, under diff --git a/src/main/java/io/floci/aws/services/rds/RdsService.java b/src/main/java/io/floci/aws/services/rds/RdsService.java index 8586028ec2..e446b6f9bc 100644 --- a/src/main/java/io/floci/aws/services/rds/RdsService.java +++ b/src/main/java/io/floci/aws/services/rds/RdsService.java @@ -1392,11 +1392,6 @@ public class RdsService implements Resettable, ResourceProvider { throw new AwsException("InvalidDBSnapshotState", "DBSnapshot " + snapshotId + " is not in an available state.", 400); } - if ((engineVersion == null || engineVersion.isBlank()) - && (optionGroupName == null || optionGroupName.isBlank())) { - throw new AwsException("InvalidParameterCombination", - "At least one snapshot attribute must be specified.", 400); - } if (engineVersion != null && !engineVersion.isBlank()) { snapshot.setEngineVersion(engineVersion); } diff --git a/src/test/java/io/floci/aws/services/rds/RdsServiceTest.java b/src/test/java/io/floci/aws/services/rds/RdsServiceTest.java index 9396708e28..0c0ee391b3 100644 --- a/src/test/java/io/floci/aws/services/rds/RdsServiceTest.java +++ b/src/test/java/io/floci/aws/services/rds/RdsServiceTest.java @@ -7552,9 +7552,28 @@ class RdsServiceTest { assertEquals("14", modified.getEngineVersion()); assertEquals("new-options", modified.getOptionGroupName()); - AwsException missingChange = assertThrows(AwsException.class, () -> - rdsService.modifyDbSnapshot("mysnap", null, null, "us-east-1")); - assertEquals("InvalidParameterCombination", missingChange.getErrorCode()); + } + + @Test + void modifyDbSnapshotNamingNothingReturnsTheSnapshotUnchanged() { + rdsService.createDbInstance("mydb", "postgres", "13", + "admin", "password", "dbname", "db.t3.micro", + 20, false, null, null, null, null, false); + when(containerManager.createPostgresSnapshot(any(), eq("admin"))).thenReturn("MOCK_DUMP_DATA"); + rdsService.createDbSnapshot("mysnap", "mydb"); + rdsService.modifyDbSnapshot("mysnap", "14", "new-options", "us-east-1"); + + DbSnapshot unchanged = rdsService.modifyDbSnapshot("mysnap", null, null, "us-east-1"); + + assertEquals("mysnap", unchanged.getDbSnapshotIdentifier()); + assertEquals("14", unchanged.getEngineVersion()); + assertEquals("new-options", unchanged.getOptionGroupName()); + DbSnapshot stored = rdsService.describeDbSnapshots("mysnap", null, "us-east-1").iterator().next(); + assertEquals("14", stored.getEngineVersion()); + assertEquals("new-options", stored.getOptionGroupName()); + AwsException missing = assertThrows(AwsException.class, () -> + rdsService.modifyDbSnapshot("no-such-snap", null, null, "us-east-1")); + assertEquals("DBSnapshotNotFound", missing.getErrorCode()); } @Test