Repository: getmoto/moto
Pull request #8433 (2024-12-23 22:49:00)

Bump ruby/setup-ruby from 1.204.0 to 1.205.0
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.204.0 to 1.205.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/ruby/setup-ruby/releases">ruby/setup-ruby's releases</a>.</em></p>
<blockquote>
<h2>v1.205.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Fixes the latest rubygems installation error with Ruby 3.0 by <a href="https://github.com/Watson1978"><code>@​Watson1978</code></a> in <a href="https://redirect.github.com/ruby/setup-ruby/pull/676">ruby/setup-ruby#676</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/Watson1978"><code>@​Watson1978</code></a> made their first contribution in <a href="https://redirect.github.com/ruby/setup-ruby/pull/676">ruby/setup-ruby#676</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/ruby/setup-ruby/compare/v1.204.0...v1.205.0">https://github.com/ruby/setup-ruby/compare/v1.204.0...v1.205.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/ruby/setup-ruby/commit/540484a3c0f308b08619664ec40bf6c371d172c3"><code>540484a</code></a> Fixes the latest rubygems installation error with Ruby 3.0</li>
<li>See full diff in <a href="https://github.com/ruby/setup-ruby/compare/401c19e14f474b54450cd3905bb8b86e2c8509cf...540484a3c0f308b08619664ec40bf6c371d172c3">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ruby/setup-ruby&package-manager=github_actions&previous-version=1.204.0&new-version=1.205.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/moto/core/models.py b/moto/core/models.py
index 123e753f5..bc16305a8 100644
--- a/moto/core/models.py
+++ b/moto/core/models.py
@@ -305,7 +305,7 @@ def patch_client(client: botocore.client.BaseClient) -> None:
             #  - in 99% of the cases there are no duplicate event handlers, so it doesn't matter if the check fails
             pass
 
-        client.meta.events.register("before-send", botocore_stubber)
+        client.meta.events.register("before-send", botocore_stubber)  # type: ignore[arg-type]
     else:
         raise Exception(f"Argument {client} should be of type boto3.client")
 
diff --git a/moto/dsql/exceptions.py b/moto/dsql/exceptions.py
index 69cbb6b2e..6a9d8bcd0 100644
--- a/moto/dsql/exceptions.py
+++ b/moto/dsql/exceptions.py
@@ -1,1 +1,12 @@
 """Exceptions raised by the dsql service."""
+
+from moto.core.exceptions import JsonRESTError
+
+
+class ValidationException(JsonRESTError):
+    """Tag validation failed."""
+
+    code = 400
+
+    def __init__(self, message: str):
+        super().__init__("ValidationException", message)
diff --git a/moto/dsql/models.py b/moto/dsql/models.py
index 64124fe4d..fb937a40a 100644
--- a/moto/dsql/models.py
+++ b/moto/dsql/models.py
@@ -10,6 +10,8 @@ from moto.moto_api._internal import mock_random
 from moto.moto_api._internal.managed_state_model import ManagedState
 from moto.utilities.utils import get_partition
 
+from .exceptions import ValidationException
+
 
 class Cluster(BaseModel, ManagedState):
     """Model for an AuroraDSQL cluster."""
@@ -68,6 +70,17 @@ class AuroraDSQLBackend(BaseBackend):
             tags,
             client_token,
         )
+        self.clusters[cluster.identifier] = cluster
+        return cluster
+
+    def get_cluster(
+        self,
+        identifier: str,
+    ) -> Cluster:
+        cluster = self.clusters.get(identifier)
+        if cluster is None:
+            raise ValidationException("invalid Cluster Id")
+
         return cluster
 
 
diff --git a/moto/dsql/responses.py b/moto/dsql/responses.py
index 3e3f23198..cde9965d9 100644
--- a/moto/dsql/responses.py
+++ b/moto/dsql/responses.py
@@ -30,3 +30,9 @@ class AuroraDSQLResponse(BaseResponse):
         )
 
         return json.dumps(dict(cluster.to_dict()))
+
+    def get_cluster(self) -> str:
+        identifier = self.path.split("/")[-1]
+        cluster = self.dsql_backend.get_cluster(identifier=identifier)
+
+        return json.dumps(dict(cluster.to_dict()))
diff --git a/moto/dsql/urls.py b/moto/dsql/urls.py
index 8fbbf12ff..4c15cdde4 100644
--- a/moto/dsql/urls.py
+++ b/moto/dsql/urls.py
@@ -8,4 +8,5 @@ url_bases = [
 
 url_paths = {
     "{0}/cluster$": AuroraDSQLResponse.dispatch,
+    "{0}/cluster/(?P<identifier>[^/]+)$": AuroraDSQLResponse.dispatch,
 }
diff --git a/setup.cfg b/setup.cfg
index 086c4acbc..1952101b0 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,7 @@
 [metadata]
 name = moto
 version = 5.0.25.dev
+description = A library that allows you to easily mock out tests based on AWS infrastructure
 long_description = file:README.md
 long_description_content_type = text/markdown
 author = Steve Pulec


Test patch:
diff --git a/.github/workflows/tests_sdk_ruby.yml b/.github/workflows/tests_sdk_ruby.yml
index 08aacf89c..a40bace00 100644
--- a/.github/workflows/tests_sdk_ruby.yml
+++ b/.github/workflows/tests_sdk_ruby.yml
@@ -13,7 +13,7 @@ jobs:
     steps:
       - uses: actions/checkout@v4
       - name: Set up Ruby ${{ matrix.ruby-version }}
-        uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf
+        uses: ruby/setup-ruby@540484a3c0f308b08619664ec40bf6c371d172c3
         with:
           ruby-version: ${{ matrix.ruby-version }}
       - name: Set up Python 3.8
diff --git a/tests/test_dsql/test_dsql.py b/tests/test_dsql/test_dsql.py
index 7bfdd95f6..9d0e438e5 100644
--- a/tests/test_dsql/test_dsql.py
+++ b/tests/test_dsql/test_dsql.py
@@ -3,15 +3,18 @@
 from datetime import datetime
 
 import boto3
+from botocore.exceptions import ClientError
 from dateutil.tz import tzutc
 from freezegun import freeze_time
 
 from moto import mock_aws, settings
 
+TEST_REGION = "us-east-1"
+
 
 @mock_aws
 def test_create_cluster():
-    client = boto3.client("dsql", region_name="us-east-1")
+    client = boto3.client("dsql", region_name=TEST_REGION)
     with freeze_time("2024-12-22 12:34:00"):
         resp = client.create_cluster()
 
@@ -22,3 +25,37 @@ def test_create_cluster():
     assert resp["status"] == "CREATING"
     if not settings.TEST_SERVER_MODE:
         assert resp["creationTime"] == datetime(2024, 12, 22, 12, 34, tzinfo=tzutc())
+
+
+@mock_aws
+def test_get_invalid_cluster():
+    client = boto3.client("dsql", region_name=TEST_REGION)
+
+    try:
+        client.get_cluster(identifier="invalid")
+    except ClientError as err:
+        assert err.response["Error"]["Code"] == "ValidationException"
+        assert err.response["Error"]["Message"] == "invalid Cluster Id"
+
+
+@mock_aws
+def test_get_cluster():
+    client = boto3.client("dsql", region_name=TEST_REGION)
+    with freeze_time("2024-12-22 12:34:00"):
+        resp = client.create_cluster()
+
+    identifier = resp["identifier"]
+
+    get_resp = client.get_cluster(identifier=identifier)
+
+    # TODO Add `witnessRegion` and `linkedClusterArns` when implement create-multi-region-clusters
+    assert get_resp["identifier"] == identifier
+    assert (
+        get_resp["arn"] == f"arn:aws:dsql:us-east-1:123456789012:cluster/{identifier}"
+    )
+    assert get_resp["deletionProtectionEnabled"] is True
+    assert get_resp["status"] == "CREATING"
+    if not settings.TEST_SERVER_MODE:
+        assert get_resp["creationTime"] == datetime(
+            2024, 12, 22, 12, 34, tzinfo=tzutc()
+        )