Common: Add AbstractEvent

This commit is contained in:
Mike Salvatore 2022-08-02 13:15:33 -04:00
parent 2c55b8a4df
commit e79a29f7aa
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1 @@
from abstract_event import AbstractEvent

View File

@ -0,0 +1,27 @@
from abc import ABC
from dataclasses import dataclass
from ipaddress import IPv4Address
from typing import FrozenSet, Union
from uuid import UUID
@dataclass(frozen=True)
class AbstractEvent(ABC):
"""
An event that was initiated or observed by an agent
Agents perform actions and collect data. These actions and data are represented as "events".
Subtypes of `AbstractEvent` will have additional properties that provide context and information
about the event.
Attributes:
:param source: The UUID of the agent that observed the event
:param target: The target of the event (if not the local system)
:param timestamp: The time that the event occurred (seconds since the Unix epoch)
:param tags: The set of tags associated with the event
"""
source: UUID
target: Union[UUID, IPv4Address, None]
timestamp: float
tags: FrozenSet[str]