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
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-11-16 15:41:03 -04:00
1 parent a35fcfd9da
commit 16b0b516a0
4 files changed
+28 -10

No files matched your search

@@ -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");
+4 -2
View File
@@ -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
@@ -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);
}
@@ -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