Skip to content

Commit

Permalink
[DBCluster] Support GlobalWriteForwarding on ModifyDBCluster
Browse files Browse the repository at this point in the history
  • Loading branch information
Diogo Henriques committed Oct 16, 2023
1 parent d7c48d1 commit 58e5a35
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aws-rds-dbcluster/aws-rds-dbcluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
"type": "string"
}
},
"EnableGlobalWriteForwarding": {
"description": "Specifies whether to enable this DB cluster to forward write operations to the primary cluster of a global cluster (Aurora global database). By default, write operations are not allowed on Aurora DB clusters that are secondary clusters in an Aurora global database.",
"type": "boolean"
},
"EnableHttpEndpoint": {
"description": "A value that indicates whether to enable the HTTP endpoint for an Aurora Serverless DB cluster. By default, the HTTP endpoint is disabled.",
"type": "boolean"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ static ModifyDbClusterRequest modifyDbClusterAfterCreateRequest(final ResourceMo
.deletionProtection(desiredModel.getDeletionProtection())
.domain(desiredModel.getDomain())
.domainIAMRoleName(desiredModel.getDomainIAMRoleName())
.enableGlobalWriteForwarding(desiredModel.getEnableGlobalWriteForwarding())
.enableHttpEndpoint(desiredModel.getEnableHttpEndpoint())
.enablePerformanceInsights(desiredModel.getPerformanceInsightsEnabled())
.iops(desiredModel.getIops())
Expand Down Expand Up @@ -261,6 +262,7 @@ static ModifyDbClusterRequest modifyDbClusterRequest(
.deletionProtection(desiredModel.getDeletionProtection())
.domain(desiredModel.getDomain())
.domainIAMRoleName(desiredModel.getDomainIAMRoleName())
.enableGlobalWriteForwarding(desiredModel.getEnableGlobalWriteForwarding())
.enableHttpEndpoint(desiredModel.getEnableHttpEndpoint())
.enableIAMDatabaseAuthentication(diff(previousModel.getEnableIAMDatabaseAuthentication(), desiredModel.getEnableIAMDatabaseAuthentication()))
.enablePerformanceInsights(desiredModel.getPerformanceInsightsEnabled())
Expand Down Expand Up @@ -505,6 +507,7 @@ public static ResourceModel translateDbClusterFromSdk(
.domain(domain)
.domainIAMRoleName(domainIAMRoleName)
.enableCloudwatchLogsExports(dbCluster.enabledCloudwatchLogsExports())
.enableGlobalWriteForwarding(dbCluster.globalWriteForwardingRequested())
.enableHttpEndpoint(dbCluster.httpEndpointEnabled())
.enableIAMDatabaseAuthentication(dbCluster.iamDatabaseAuthenticationEnabled())
.endpoint(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ public void modifyDbClusterRequest_setEnableIAMDatabaseAuthentication() {
assertThat(request.enableIAMDatabaseAuthentication()).isEqualTo(Boolean.TRUE);
}

@Test
public void modifyDbClusterRequest_setEnableGlobalWriteForwarding() {
final ResourceModel previousModel = RESOURCE_MODEL.toBuilder().enableGlobalWriteForwarding(false).build();
final ResourceModel desiredModel = RESOURCE_MODEL.toBuilder().enableGlobalWriteForwarding(true).build();
final Boolean isRollback = false;

final ModifyDbClusterRequest request = Translator.modifyDbClusterRequest(previousModel, desiredModel, isRollback);
assertThat(request.enableGlobalWriteForwarding()).isEqualTo(Boolean.TRUE);
}

@Test
public void ModifyDbClusterRequest_dbInstanceParameterGroupNameIsNotSetWhenEngineVersionIsNotUpgrading() {
final ResourceModel previousModel = RESOURCE_MODEL.toBuilder().engineVersion("old-engine").dBInstanceParameterGroupName("old-pg").build();
Expand Down

0 comments on commit 58e5a35

Please sign in to comment.