RDS: describe_db_clusters() now accepts an ARN as identifier (#6114)
This commit is contained in:
parent
f01709f9ba
commit
3adbb8136a
@ -1950,6 +1950,9 @@ class RDSBackend(BaseBackend):
|
|||||||
|
|
||||||
def describe_db_clusters(self, cluster_identifier):
|
def describe_db_clusters(self, cluster_identifier):
|
||||||
if cluster_identifier:
|
if cluster_identifier:
|
||||||
|
# ARN to identifier
|
||||||
|
# arn:aws:rds:eu-north-1:123456789012:cluster:cluster --> cluster-id
|
||||||
|
cluster_identifier = cluster_identifier.split(":")[-1]
|
||||||
if cluster_identifier in self.clusters:
|
if cluster_identifier in self.clusters:
|
||||||
return [self.clusters[cluster_identifier]]
|
return [self.clusters[cluster_identifier]]
|
||||||
if cluster_identifier in self.neptune.clusters:
|
if cluster_identifier in self.neptune.clusters:
|
||||||
|
@ -250,12 +250,12 @@ def test_describe_db_cluster_after_creation():
|
|||||||
MasterUserPassword="hunter2_",
|
MasterUserPassword="hunter2_",
|
||||||
)
|
)
|
||||||
|
|
||||||
client.create_db_cluster(
|
cluster_arn = client.create_db_cluster(
|
||||||
DBClusterIdentifier="cluster-id2",
|
DBClusterIdentifier="cluster-id2",
|
||||||
Engine="aurora",
|
Engine="aurora",
|
||||||
MasterUsername="root",
|
MasterUsername="root",
|
||||||
MasterUserPassword="hunter2_",
|
MasterUserPassword="hunter2_",
|
||||||
)
|
)["DBCluster"]["DBClusterArn"]
|
||||||
|
|
||||||
client.describe_db_clusters()["DBClusters"].should.have.length_of(2)
|
client.describe_db_clusters()["DBClusters"].should.have.length_of(2)
|
||||||
|
|
||||||
@ -263,6 +263,10 @@ def test_describe_db_cluster_after_creation():
|
|||||||
"DBClusters"
|
"DBClusters"
|
||||||
].should.have.length_of(1)
|
].should.have.length_of(1)
|
||||||
|
|
||||||
|
client.describe_db_clusters(DBClusterIdentifier=cluster_arn)[
|
||||||
|
"DBClusters"
|
||||||
|
].should.have.length_of(1)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds
|
@mock_rds
|
||||||
def test_delete_db_cluster():
|
def test_delete_db_cluster():
|
||||||
|
Loading…
Reference in New Issue
Block a user