Common: Rename EventSerializerRegistry -> AgentEventSerializerRegistry

This commit is contained in:
Shreya Malviya 2022-09-16 12:24:44 +05:30 committed by Mike Salvatore
parent c4ab5d99a9
commit 6ced4af5dc
3 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,5 @@
from .consts import EVENT_TYPE_FIELD from .consts import EVENT_TYPE_FIELD
from .i_agent_event_serializer import IAgentEventSerializer, JSONSerializable from .i_agent_event_serializer import IAgentEventSerializer, JSONSerializable
from .event_serializer_registry import EventSerializerRegistry from .event_serializer_registry import AgentEventSerializerRegistry
from .pydantic_event_serializer import PydanticEventSerializer from .pydantic_event_serializer import PydanticEventSerializer
from .register import register_common_agent_event_serializers from .register import register_common_agent_event_serializers

View File

@ -4,12 +4,12 @@ from common.event_serializers import IAgentEventSerializer
from common.events import AbstractAgentEvent from common.events import AbstractAgentEvent
class EventSerializerRegistry: class AgentEventSerializerRegistry:
""" """
Registry for event serializers using event class. Registry for event serializers using event class.
Example: Example:
event_serializer_registry = EventSerializerRegistry() event_serializer_registry = AgentEventSerializerRegistry()
event_serializer_registry[MyEvent] = MyEventSerializer() event_serializer_registry[MyEvent] = MyEventSerializer()
my_event_dict = {"type": "MyEvent", "data": "123"} my_event_dict = {"type": "MyEvent", "data": "123"}

View File

@ -1,9 +1,11 @@
from common.events import CredentialsStolenEvent from common.events import CredentialsStolenEvent
from . import EventSerializerRegistry, PydanticEventSerializer from . import AgentEventSerializerRegistry, PydanticEventSerializer
def register_common_agent_event_serializers(event_serializer_registry: EventSerializerRegistry): def register_common_agent_event_serializers(
event_serializer_registry: AgentEventSerializerRegistry,
):
event_serializer_registry[CredentialsStolenEvent] = PydanticEventSerializer( event_serializer_registry[CredentialsStolenEvent] = PydanticEventSerializer(
CredentialsStolenEvent CredentialsStolenEvent
) )