uptime-kuma-api/scripts/notification_providers.py.j2

32 lines
1,017 B
Text
Raw Normal View History

2022-07-02 16:00:54 +02:00
from enum import Enum
class NotificationType(str, Enum):
"""Enumerate notification types."""
{% for provider in notification_providers %}
{{ provider.upper().replace(".", "_") }} = "{{ provider }}"
"""{{ notification_providers[provider]["title"] }}"""
{% endfor %}
2022-07-02 16:00:54 +02:00
notification_provider_options = {
{%- for provider in notification_providers %}
NotificationType.{{ provider.upper().replace(".", "_") }}: dict(
{%- for input_name in notification_providers[provider]["inputs"] %}
{%- set input = notification_providers[provider]["inputs"][input_name] %}
{{ input_name }}=dict(type="{{ input["type"] }}", required={{ input["required"] }}),
2022-07-02 16:00:54 +02:00
{%- endfor %}
),
2022-07-02 16:00:54 +02:00
{%- endfor %}
}
notification_provider_conditions = dict(
2022-09-07 13:04:16 +02:00
{%- for provider in notification_provider_conditions %}
{{ provider }}=dict(
2022-09-07 13:04:16 +02:00
{%- for key, value in notification_provider_conditions[provider].items() %}
{{ key }}={{ value }},
2022-09-07 13:04:16 +02:00
{%- endfor %}
),
2022-09-07 13:04:16 +02:00
{%- endfor %}
)
2022-09-07 13:04:16 +02:00