Skip to content

Commit

Permalink
Update ValidationError for DbClusterEndpointResource
Browse files Browse the repository at this point in the history
  • Loading branch information
Russsnizza committed Sep 27, 2024
1 parent d4f4437 commit 6e1a966
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/java/gyro/aws/rds/DbClusterEndpointResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,21 @@ public void delete(GyroUI ui, State state) {
@Override
public List<ValidationError> validate(Set<String> configuredFields) {
List<ValidationError> errors = new ArrayList<>();

// Add validation for Aurora DB and endpointType 'WRITER'
String engine = getDbCluster().getEngine();
if ((engine.equalsIgnoreCase("aurora-mysql") || engine.equalsIgnoreCase("aurora-postgresql"))
&& getEndpointType().equalsIgnoreCase("WRITER")) {
errors.add(new ValidationError(
this,
"dbCluster",
"Database engine " + engine + " with endpointType 'WRITER' is not supported"));
if (getDbCluster() != null) {
String engine = getDbCluster().getEngine();
if (engine != null && getEndpointType() != null) {
if ((engine.equalsIgnoreCase("aurora-mysql") || engine.equalsIgnoreCase("aurora-postgresql"))
&& getEndpointType().equalsIgnoreCase("WRITER")) {
errors.add(new ValidationError(
this,
"dbCluster",
"Database engine " + engine + " with endpointType 'WRITER' is not supported"));
}
}
}

return errors;
}
}

0 comments on commit 6e1a966

Please sign in to comment.