orangeqs.juice.alerting._schemas#
Schema definitions for OrangeQS Juice Alerting.
Module Contents#
Classes#
Base class for protocol classes. |
|
Configuration schema describing a sender implementation type. |
|
Configuration schema for the Alert Routing layer. |
|
Base class for configurations that can be loaded from disk. |
|
Configuration schema for SMTP credentials. |
|
Configuration schema for non-sensitive SMTP sender settings. |
|
Configuration schema for the Juice Alerts module. |
|
Event class for alert messages. |
API#
- class orangeqs.juice.alerting._schemas.SenderInterface#
Bases:
typing.ProtocolBase class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol): def meth(self) -> int: ...Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example::
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type checkSee PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::
class GenProto[T](Protocol): def meth(self) -> T: ...- async send(topic: str, title: str, body: str) None#
Delivers a fully rendered alert message to the specified receivers.
Parameters#
topic (str): The alert topic.
title (str): A short, human-readable summary of the alert.
body (str): The complete alert message.
Raises#
(Exception): If the alert could not be delivered.
- class orangeqs.juice.alerting._schemas.SenderConfig(/, **data: Any)#
Bases:
pydantic.BaseModelConfiguration schema describing a sender implementation type.
- class orangeqs.juice.alerting._schemas.AlertRouting(/, **data: Any)#
Bases:
orangeqs.juice.settings.ConfigurableConfiguration schema for the Alert Routing layer.
- juice_alert_routing: dict[str, list[orangeqs.juice.alerting._schemas.SenderConfig]]#
None
Mapping of alert topics to lists of sender configurations.
- default_alert_routing: list[orangeqs.juice.alerting._schemas.SenderConfig]#
None
- class orangeqs.juice.alerting._schemas.AlertDefinition(/, **data: Any)#
Bases:
orangeqs.juice.settings.ConfigurableBase class for configurations that can be loaded from disk.
This method should be subclassed by any model that needs to load its configuration from disk. The
filenameclass variable defines which files to load, which should be unique across all configurations in an OrangeQS Juice installation.Examples#
Create a subclass of
Configurableto define your configuration model:class ExampleConfig(Configurable): filename = "example" some_setting: str = "default_value" another_setting: int = 42 config = ExampleConfig.load() assert config.some_setting == "default_value"
- class orangeqs.juice.alerting._schemas.SmtpSecretsConfig(/, **data: Any)#
Bases:
orangeqs.juice.settings.ConfigurableConfiguration schema for SMTP credentials.
- class orangeqs.juice.alerting._schemas.SmtpSenderConfig(/, **data: Any)#
Bases:
orangeqs.juice.settings.ConfigurableConfiguration schema for non-sensitive SMTP sender settings.
- class orangeqs.juice.alerting._schemas.JuiceAlerts(/, **data: Any)#
Bases:
orangeqs.juice.settings.ConfigurableConfiguration schema for the Juice Alerts module.
- juice_alert_definitions: dict[str, orangeqs.juice.alerting._schemas.AlertDefinition]#
None