RDS: Clusters now support the ServerlessV2ScalingConfiguration parameter (#6736)

This commit is contained in:
Bert Blommers 2023-08-28 07:29:52 +00:00 committed by GitHub
parent 956dd265f0
commit 7cf432b412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 3 deletions

View File

@ -208,6 +208,9 @@ class Cluster:
"timeout_action": "RollbackCapacityChange",
"seconds_before_timeout": 300,
}
self.serverless_v2_scaling_configuration = kwargs.get(
"serverless_v2_scaling_configuration"
)
self.cluster_members: List[str] = list()
self.replication_source_identifier = kwargs.get("replication_source_identifier")
self.read_replica_identifiers: List[str] = list()
@ -378,6 +381,12 @@ class Cluster:
{% if "seconds_before_timeout" in cluster.scaling_configuration %}<SecondsBeforeTimeout>{{ cluster.scaling_configuration["seconds_before_timeout"] }}</SecondsBeforeTimeout>{% endif %}
</ScalingConfigurationInfo>
{% endif %}
{% if cluster.serverless_v2_scaling_configuration %}
<ServerlessV2ScalingConfiguration>
{% if "MinCapacity" in cluster.serverless_v2_scaling_configuration %}<MinCapacity>{{ cluster.serverless_v2_scaling_configuration["MinCapacity"] }}</MinCapacity>{% endif %}
{% if "MaxCapacity" in cluster.serverless_v2_scaling_configuration %}<MaxCapacity>{{ cluster.serverless_v2_scaling_configuration["MaxCapacity"] }}</MaxCapacity>{% endif %}
</ServerlessV2ScalingConfiguration>
{% endif %}
{%- if cluster.global_cluster_identifier -%}
<GlobalClusterIdentifier>{{ cluster.global_cluster_identifier }}</GlobalClusterIdentifier>
{%- endif -%}

View File

@ -178,13 +178,12 @@ class RDSResponse(BaseResponse):
}
def _get_db_cluster_kwargs(self) -> Dict[str, Any]:
params = self._get_params()
return {
"availability_zones": self._get_multi_param(
"AvailabilityZones.AvailabilityZone"
),
"enable_cloudwatch_logs_exports": self._get_params().get(
"EnableCloudwatchLogsExports"
),
"enable_cloudwatch_logs_exports": params.get("EnableCloudwatchLogsExports"),
"db_name": self._get_param("DatabaseName"),
"db_cluster_identifier": self._get_param("DBClusterIdentifier"),
"db_subnet_group_name": self._get_param("DBSubnetGroupName"),
@ -208,6 +207,9 @@ class RDSResponse(BaseResponse):
"copy_tags_to_snapshot": self._get_param("CopyTagsToSnapshot"),
"tags": self.unpack_list_params("Tags", "Tag"),
"scaling_configuration": self._get_dict_param("ScalingConfiguration."),
"serverless_v2_scaling_configuration": params.get(
"ServerlessV2ScalingConfiguration"
),
"replication_source_identifier": self._get_param(
"ReplicationSourceIdentifier"
),

View File

@ -219,6 +219,10 @@ def test_create_db_cluster_additional_parameters():
"MinCapacity": 5,
"AutoPause": True,
},
ServerlessV2ScalingConfiguration={
"MinCapacity": 2,
"MaxCapacity": 4,
},
VpcSecurityGroupIds=["sg1", "sg2"],
)
@ -236,6 +240,10 @@ def test_create_db_cluster_additional_parameters():
assert cluster["NetworkType"] == "IPV4"
assert cluster["DBSubnetGroup"] == "subnetgroupname"
assert cluster["ScalingConfigurationInfo"] == {"MinCapacity": 5, "AutoPause": True}
assert cluster["ServerlessV2ScalingConfiguration"] == {
"MaxCapacity": 4.0,
"MinCapacity": 2.0,
}
security_groups = cluster["VpcSecurityGroups"]
assert len(security_groups) == 2