RDS: add enable_http_endpoint attribute (#5470)
This commit is contained in:
parent
03a43a9a0d
commit
b0e78140f5
@ -114,6 +114,31 @@ class Cluster:
|
||||
self.enabled_cloudwatch_logs_exports = (
|
||||
kwargs.get("enable_cloudwatch_logs_exports") or []
|
||||
)
|
||||
self.enable_http_endpoint = False
|
||||
# instead of raising an error on aws rds create-db-cluster commands with
|
||||
# incompatible configurations with enable_http_endpoint
|
||||
# (e.g. engine_mode is not set to "serverless"), the API
|
||||
# automatically sets the enable_http_endpoint parameter to False
|
||||
if kwargs.get("enable_http_endpoint"):
|
||||
if self.engine_mode == "serverless":
|
||||
if self.engine == "aurora-mysql" and self.engine_version in [
|
||||
"5.6.10a",
|
||||
"5.6.1",
|
||||
"2.07.1",
|
||||
"5.7.2",
|
||||
]:
|
||||
self.enable_http_endpoint = kwargs.get(
|
||||
"enable_http_endpoint", False
|
||||
)
|
||||
elif self.engine == "aurora-postgresql" and self.engine_version in [
|
||||
"10.12",
|
||||
"10.14",
|
||||
"10.18",
|
||||
"11.13",
|
||||
]:
|
||||
self.enable_http_endpoint = kwargs.get(
|
||||
"enable_http_endpoint", False
|
||||
)
|
||||
|
||||
@property
|
||||
def db_cluster_arn(self):
|
||||
@ -170,7 +195,7 @@ class Cluster:
|
||||
<IAMDatabaseAuthenticationEnabled>false</IAMDatabaseAuthenticationEnabled>
|
||||
<EngineMode>{{ cluster.engine_mode }}</EngineMode>
|
||||
<DeletionProtection>{{ 'true' if cluster.deletion_protection else 'false' }}</DeletionProtection>
|
||||
<HttpEndpointEnabled>false</HttpEndpointEnabled>
|
||||
<HttpEndpointEnabled>{{ cluster.enable_http_endpoint }}</HttpEndpointEnabled>
|
||||
<CopyTagsToSnapshot>{{ cluster.copy_tags_to_snapshot }}</CopyTagsToSnapshot>
|
||||
<CrossAccountClone>false</CrossAccountClone>
|
||||
<DomainMemberships></DomainMemberships>
|
||||
|
@ -117,6 +117,7 @@ class RDSResponse(BaseResponse):
|
||||
"parameter_group": self._get_param("DBClusterParameterGroup"),
|
||||
"region": self.region,
|
||||
"db_cluster_instance_class": self._get_param("DBClusterInstanceClass"),
|
||||
"enable_http_endpoint": self._get_param("EnableHttpEndpoint"),
|
||||
"copy_tags_to_snapshot": self._get_param("CopyTagsToSnapshot"),
|
||||
"tags": self.unpack_complex_list_params("Tags.Tag", ("Key", "Value")),
|
||||
}
|
||||
|
@ -716,3 +716,39 @@ def test_add_tags_to_cluster_snapshot():
|
||||
|
||||
tags = conn.list_tags_for_resource(ResourceName=snapshot_arn)["TagList"]
|
||||
tags.should.equal([{"Key": "k2", "Value": "v2"}])
|
||||
|
||||
|
||||
@mock_rds
|
||||
def test_create_db_cluster_with_enable_http_endpoint_valid():
|
||||
client = boto3.client("rds", region_name="eu-north-1")
|
||||
|
||||
resp = client.create_db_cluster(
|
||||
DBClusterIdentifier="cluster-id",
|
||||
DatabaseName="users",
|
||||
Engine="aurora-mysql",
|
||||
EngineMode="serverless",
|
||||
EngineVersion="5.6.10a",
|
||||
MasterUsername="root",
|
||||
MasterUserPassword="hunter2_",
|
||||
EnableHttpEndpoint=True,
|
||||
)
|
||||
cluster = resp["DBCluster"]
|
||||
cluster.should.have.key("HttpEndpointEnabled").equal(True)
|
||||
|
||||
|
||||
@mock_rds
|
||||
def test_create_db_cluster_with_enable_http_endpoint_invalid():
|
||||
client = boto3.client("rds", region_name="eu-north-1")
|
||||
|
||||
resp = client.create_db_cluster(
|
||||
DBClusterIdentifier="cluster-id",
|
||||
DatabaseName="users",
|
||||
Engine="aurora-mysql",
|
||||
EngineMode="serverless",
|
||||
EngineVersion="5.7.0",
|
||||
MasterUsername="root",
|
||||
MasterUserPassword="hunter2_",
|
||||
EnableHttpEndpoint=True,
|
||||
)
|
||||
cluster = resp["DBCluster"]
|
||||
cluster.should.have.key("HttpEndpointEnabled").equal(False)
|
||||
|
Loading…
Reference in New Issue
Block a user