feat(schema): add Alert -> enodia.event.v1 reference wrapper
This commit is contained in:
parent
54bd8ff1f4
commit
65f5be6420
3 changed files with 22 additions and 0 deletions
|
|
@ -44,3 +44,8 @@ def build_event(
|
|||
"host": host,
|
||||
event_type: payload,
|
||||
}
|
||||
|
||||
|
||||
def from_alert(alert, *, host: str | None = None, timestamp: str | None = None) -> dict:
|
||||
"""Wrap an ``Alert`` (via its ``to_dict()``) in an ``alert`` event envelope."""
|
||||
return build_event("alert", alert.to_dict(), host=host, timestamp=timestamp)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue