Repository: getmoto/moto (python)

Issue:
[RDS] `create_global_cluster` does not return `Endpoint`
The RDS API call `create_global_cluster` returns an `Endpoint` value which contains the global writer endpoint for the newly created global cluster. This value was added into boto3 in version 1.35.46 (https://github.com/boto/boto3/blob/develop/CHANGELOG.rst)

> https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/rds/client/create_global_cluster.html
>
> Endpoint (string) –
> The writer endpoint for the new global database cluster. This endpoint always points to the writer DB instance in the current primary cluster.

Below is an example of reproducing the issue.

```
Python 3.12.2 (main, Feb 20 2024, 09:09:44) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import moto
>>> moto.__version__
'5.0.28'

>>> import boto3
>>> boto3.__version__
'1.36.21'

>>> mock = moto.mock_aws()
>>> mock.start()

>>> rds = boto3.client("rds")
>>> rds.create_global_cluster(GlobalClusterIdentifier="test-global-cluster", Engine="aurora-postgresql", EngineVersion="16.4")
{'GlobalCluster': {'GlobalClusterIdentifier': 'test-global-cluster', 'GlobalClusterResourceId': 'cluster-2d4ab38f', 'GlobalClusterArn': 'arn:aws:rds::123456789012:global-cluster:test-global-cluster', 'Status': 'available', 'Engine': 'aurora-postgresql', 'EngineVersion': '16.4', 'StorageEncrypted': False, 'DeletionProtection': False, 'GlobalClusterMembers': []}, 'ResponseMetadata': {'RequestId': 'auOPmQrF8HvBOsqdgKgmc4WwAw42pZIPO3hMMF1qEq95ct7yrd5T', 'HTTPStatusCode': 200, 'HTTPHeaders': {'server': 'amazon.com', 'date': 'Tue, 18 Feb 2025 16:31:39 GMT', 'x-amzn-requestid': 'auOPmQrF8HvBOsqdgKgmc4WwAw42pZIPO3hMMF1qEq95ct7yrd5T'}, 'RetryAttempts': 0}}
```

Pull request description:
RDS: Add GlobalCluster.Endpoint attribute
Closes #8606 

Patch:
diff --git a/moto/rds/models.py b/moto/rds/models.py
index e3363a34f..fc23353d4 100644
--- a/moto/rds/models.py
+++ b/moto/rds/models.py
@@ -303,7 +303,8 @@ class GlobalCluster(RDSBaseModel):
     ):
         super().__init__(backend)
         self.global_cluster_identifier = global_cluster_identifier
-        self.global_cluster_resource_id = "cluster-" + random.get_random_hex(8)
+        self.unique_identifier = random.get_random_hex(8)
+        self.global_cluster_resource_id = f"cluster-{self.unique_identifier}"
         self.engine = engine
         self.engine_version = engine_version or DBCluster.default_engine_version(
             self.engine
@@ -326,6 +327,11 @@ class GlobalCluster(RDSBaseModel):
         # Global Clusters do not belong to a particular region.
         return super().arn.replace(self.region, "")
 
+    @property
+    def endpoint(self) -> str:
+        ep = f"{self.global_cluster_identifier}.global-{self.unique_identifier}.global.rds.amazonaws.com"
+        return ep
+
     @property
     def global_cluster_arn(self) -> str:
         return self.arn


Test patch:
diff --git a/tests/test_rds/test_global_clusters.py b/tests/test_rds/test_global_clusters.py
index d61208b5e..df4e26412 100644
--- a/tests/test_rds/test_global_clusters.py
+++ b/tests/test_rds/test_global_clusters.py
@@ -38,6 +38,7 @@ def test_global_cluster_members():
         == f"arn:aws:rds::{DEFAULT_ACCOUNT_ID}:global-cluster:gc1"
     )
     assert global_cluster["Status"] == "available"
+    assert "Endpoint" in global_cluster
     assert global_cluster["Engine"] == "aurora-mysql"
     assert "mysql_aurora" in global_cluster["EngineVersion"]
     assert global_cluster["StorageEncrypted"] is False
@@ -57,7 +58,7 @@ def test_global_cluster_members():
     assert len(resp["GlobalClusters"]) == 1
     global_cluster = resp["GlobalClusters"][0]
     assert global_cluster["GlobalClusterIdentifier"] == "gc1"
-
+    assert "Endpoint" in global_cluster
     assert len(global_cluster["GlobalClusterMembers"]) == 1
     assert global_cluster["GlobalClusterMembers"][0]["DBClusterArn"] == cluster_arn