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

31 lines
501 B
Python
Raw Normal View History

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