selfprivacy-rest-api/selfprivacy_api/graphql/queries/common.py

32 lines
502 B
Python
Raw Normal View History

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
import typing
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
timestamp: typing.Optional[datetime.datetime]