2022-06-24 12:26:51 +00:00
|
|
|
"""Common types and enums used by different types of queries."""
|
2024-06-10 01:52:26 +00:00
|
|
|
|
2022-06-24 12:26:51 +00:00
|
|
|
from enum import Enum
|
|
|
|
import datetime
|
2024-11-15 00:35:07 +00:00
|
|
|
from typing import Optional
|
2022-06-24 12:26:51 +00:00
|
|
|
import strawberry
|
|
|
|
|
2022-06-24 18:14:20 +00:00
|
|
|
|
2022-06-24 12:26:51 +00:00
|
|
|
@strawberry.enum
|
|
|
|
class Severity(Enum):
|
|
|
|
"""
|
|
|
|
Severity of an alert.
|
|
|
|
"""
|
2022-06-24 18:14:20 +00:00
|
|
|
|
2022-06-24 12:26:51 +00:00
|
|
|
INFO = "INFO"
|
|
|
|
WARNING = "WARNING"
|
|
|
|
ERROR = "ERROR"
|
|
|
|
CRITICAL = "CRITICAL"
|
|
|
|
SUCCESS = "SUCCESS"
|
|
|
|
|
2022-06-24 18:14:20 +00:00
|
|
|
|
2022-06-24 12:26:51 +00:00
|
|
|
@strawberry.type
|
|
|
|
class Alert:
|
|
|
|
"""
|
|
|
|
Alert type.
|
|
|
|
"""
|
2022-06-24 18:14:20 +00:00
|
|
|
|
2022-06-24 12:26:51 +00:00
|
|
|
severity: Severity
|
|
|
|
title: str
|
|
|
|
message: str
|
2024-11-15 00:35:07 +00:00
|
|
|
timestamp: Optional[datetime.datetime]
|