Skip to content

Commit

Permalink
[DBInstance][DBCluster] Add more terminal states
Browse files Browse the repository at this point in the history
This change is to add more terminal states so that instance/cluster
operations fail fast if these states are reached, instead of waiting for
the stabilization process to time out.

Status references:
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/accessing-monitoring.html
- https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/accessing-monitoring.html
  • Loading branch information
zrfr committed Jun 4, 2024
1 parent 9dbcb78 commit d5d91d3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package software.amazon.rds.common.status;

/**
* Represents a status that could be considered "terminal" for a resource.
* Terminal states cause resource stabilization to fail immediately. If a
* resource enters a terminal state following a mutation, the operation fails
* with a {@link software.amazon.cloudformation.exceptions.CfnNotStabilizedException}.
*/
public interface TerminableStatus extends Status {
/**
* Returns true if the status is terminal.
*/
boolean isTerminal();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ public enum DBClusterStatus implements TerminableStatus {
Creating("creating"),
Deleted("deleted"),
InaccessibleEncryptionCredentials("inaccessible-encryption-credentials", true),
InaccessibleEncryptionCredentialsRecoverable("inaccessible-encryption-credentials-recoverable", true),
IncompatibleNetwork("incompatible-network", true),
IncompatibleParameters("incompatible-parameters", true),
IncompatibleRestore("incompatible-restore", true);
IncompatibleRestore("incompatible-restore", true),
MigrationFailed("migration-failed", true),
RestoreFailed("restore-failed", true);


private final String value;
private final boolean isTerminal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ public enum DBInstanceStatus implements TerminableStatus {
Deleting("deleting"),
Failed("failed", true),
InaccessibleEncryptionCredentials("inaccessible-encryption-credentials", true),
InaccessibleEncryptionCredentialsRecoverable("inaccessible-encryption-credentials-recoverable", true),
IncompatibleCreate("incompatible-create", true),
IncompatibleCredentials("incompatible-credentials", true),
IncompatibleNetwork("incompatible-network", true),
IncompatibleParameters("incompatible-parameters", true),
IncompatibleRestore("incompatible-restore", true),
StorageFull("storage-full");
ModifyFailed("modify-failed", true),
StorageFull("storage-full"),
UpgradeFailed("upgrade-failed", true);

private final String value;
private final boolean terminal;
Expand Down

0 comments on commit d5d91d3

Please sign in to comment.