Skip to content

Commit

Permalink
feat: Implementation of memorydb api (#8108)
Browse files Browse the repository at this point in the history
  • Loading branch information
archinksagar committed Sep 14, 2024
1 parent c636d01 commit b195554
Show file tree
Hide file tree
Showing 12 changed files with 1,750 additions and 130 deletions.
191 changes: 61 additions & 130 deletions IMPLEMENTATION_COVERAGE.md

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions docs/docs/services/memorydb.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.. _implementedservice_memorydb:

.. |start-h3| raw:: html

<h3>

.. |end-h3| raw:: html

</h3>

========
memorydb
========

.. autoclass:: moto.memorydb.models.MemoryDBBackend

|start-h3| Implemented features for this service |end-h3|

- [ ] batch_update_cluster
- [ ] copy_snapshot
- [ ] create_acl
- [X] create_cluster
- [ ] create_parameter_group
- [X] create_snapshot
- [X] create_subnet_group
- [ ] create_user
- [ ] delete_acl
- [X] delete_cluster
- [ ] delete_parameter_group
- [X] delete_snapshot
- [X] delete_subnet_group
- [ ] delete_user
- [ ] describe_acls
- [X] describe_clusters
- [ ] describe_engine_versions
- [ ] describe_events
- [ ] describe_parameter_groups
- [ ] describe_parameters
- [ ] describe_reserved_nodes
- [ ] describe_reserved_nodes_offerings
- [ ] describe_service_updates
- [X] describe_snapshots
- [X] describe_subnet_groups
- [ ] describe_users
- [ ] failover_shard
- [ ] list_allowed_node_type_updates
- [X] list_tags
- [ ] purchase_reserved_nodes_offering
- [ ] reset_parameter_group
- [X] tag_resource
- [X] untag_resource
- [ ] update_acl
- [X] update_cluster
- [ ] update_parameter_group
- [ ] update_subnet_group
- [ ] update_user

1 change: 1 addition & 0 deletions moto/backend_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
("mediapackage", re.compile("https?://mediapackage\\.(.+)\\.amazonaws.com")),
("mediastore", re.compile("https?://mediastore\\.(.+)\\.amazonaws\\.com")),
("mediastoredata", re.compile("https?://data\\.mediastore\\.(.+)\\.amazonaws.com")),
("memorydb", re.compile("https?://memory-db\\.(.+)\\.amazonaws\\.com")),
(
"meteringmarketplace",
re.compile("https?://metering.marketplace.(.+).amazonaws.com"),
Expand Down
4 changes: 4 additions & 0 deletions moto/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
from moto.mediapackage.models import MediaPackageBackend
from moto.mediastore.models import MediaStoreBackend
from moto.mediastoredata.models import MediaStoreDataBackend
from moto.memorydb.models import MemoryDBBackend
from moto.meteringmarketplace.models import MeteringMarketplaceBackend
from moto.moto_api._internal.models import MotoAPIBackend
from moto.mq.models import MQBackend
Expand Down Expand Up @@ -268,6 +269,7 @@ def get_service_from_url(url: str) -> Optional[str]:
"Literal['medialive']",
"Literal['mediapackage']",
"Literal['mediastore']",
"Literal['memorydb']",
"Literal['mediastore-data']",
"Literal['meteringmarketplace']",
"Literal['moto_api']",
Expand Down Expand Up @@ -564,6 +566,8 @@ def get_backend(
name: "Literal['mediastore-data']",
) -> "BackendDict[MediaStoreDataBackend]": ...
@overload
def get_backend(name: "Literal['memorydb']") -> "BackendDict[MemoryDBBackend]": ...
@overload
def get_backend(
name: "Literal['meteringmarketplace']",
) -> "BackendDict[MeteringMarketplaceBackend]": ...
Expand Down
1 change: 1 addition & 0 deletions moto/memorydb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .models import memorydb_backends # noqa: F401
59 changes: 59 additions & 0 deletions moto/memorydb/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""Exceptions raised by the memorydb service."""

from typing import List

from moto.core.exceptions import JsonRESTError


class MemoryDBClientError(JsonRESTError):
code = 400


class ClusterAlreadyExistsFault(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("ClusterAlreadyExistsFault", msg)


class InvalidSubnetError(MemoryDBClientError):
def __init__(self, subnet_identifier: List[str]):
super().__init__("InvalidSubnetError", f"Subnet {subnet_identifier} not found.")


class SubnetGroupAlreadyExistsFault(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("SubnetGroupAlreadyExistsFault", msg)


class ClusterNotFoundFault(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("ClusterNotFoundFault", msg)


class SnapshotAlreadyExistsFault(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("SnapshotAlreadyExistsFault", msg)


class SnapshotNotFoundFault(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("SnapshotNotFoundFault", msg)


class SubnetGroupNotFoundFault(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("SubnetGroupNotFoundFault", msg)


class TagNotFoundFault(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("TagNotFoundFault", msg)


class InvalidParameterValueException(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("InvalidParameterValueException", msg)


class SubnetGroupInUseFault(MemoryDBClientError):
def __init__(self, msg: str):
super().__init__("SubnetGroupInUseFault", msg)
Loading

0 comments on commit b195554

Please sign in to comment.