feat: check for required notification arguments (#36)
This commit is contained in:
parent
f0c5f2ba9d
commit
e7693e6081
4 changed files with 473 additions and 370 deletions
|
@ -6,9 +6,84 @@ from bs4 import BeautifulSoup
|
|||
from utils import deduplicate_list, write_to_file
|
||||
|
||||
|
||||
# deprecated or wrong inputs
|
||||
ignored_inputs = {
|
||||
"slack": [
|
||||
"slackbutton"
|
||||
],
|
||||
"rocket.chat": [
|
||||
"rocketbutton"
|
||||
],
|
||||
"octopush": [
|
||||
"octopushDMLogin",
|
||||
"octopushDMAPIKey",
|
||||
"octopushDMPhoneNumber",
|
||||
"octopushDMSenderName",
|
||||
"octopushDMSMSType"
|
||||
],
|
||||
"Splunk": [
|
||||
"pagerdutyIntegrationKey"
|
||||
]
|
||||
}
|
||||
|
||||
titles = {
|
||||
"alerta": "Alerta",
|
||||
"AlertNow": "AlertNow",
|
||||
"apprise": "Apprise (Support 50+ Notification services)",
|
||||
"Bark": "Bark",
|
||||
"clicksendsms": "ClickSend SMS",
|
||||
"discord": "Discord",
|
||||
"GoogleChat": "Google Chat (Google Workspace)",
|
||||
"gorush": "Gorush",
|
||||
"gotify": "Gotify",
|
||||
"HomeAssistant": "Home Assistant",
|
||||
"Kook": "Kook",
|
||||
"line": "LINE Messenger",
|
||||
"LineNotify": "LINE Notify",
|
||||
"lunasea": "LunaSea",
|
||||
"matrix": "Matrix",
|
||||
"mattermost": "Mattermost",
|
||||
"ntfy": "Ntfy",
|
||||
"octopush": "Octopush",
|
||||
"OneBot": "OneBot",
|
||||
"Opsgenie": "Opsgenie",
|
||||
"PagerDuty": "PagerDuty",
|
||||
"pushbullet": "Pushbullet",
|
||||
"PushByTechulus": "Push by Techulus",
|
||||
"pushover": "Pushover",
|
||||
"pushy": "Pushy",
|
||||
"rocket.chat": "Rocket.Chat",
|
||||
"signal": "Signal",
|
||||
"slack": "Slack",
|
||||
"squadcast": "SquadCast",
|
||||
"SMSEagle": "SMSEagle",
|
||||
"smtp": "Email (SMTP)",
|
||||
"stackfield": "Stackfield",
|
||||
"teams": "Microsoft Teams",
|
||||
"telegram": "Telegram",
|
||||
"twilio": "Twilio",
|
||||
"Splunk": "Splunk",
|
||||
"webhook": "Webhook",
|
||||
"GoAlert": "GoAlert",
|
||||
"ZohoCliq": "ZohoCliq",
|
||||
"AliyunSMS": "AliyunSMS",
|
||||
"DingDing": "DingDing",
|
||||
"Feishu": "Feishu",
|
||||
"FreeMobile": "FreeMobile (mobile.free.fr)",
|
||||
"PushDeer": "PushDeer",
|
||||
"promosms": "PromoSMS",
|
||||
"serwersms": "SerwerSMS.pl",
|
||||
"SMSManager": "SmsManager (smsmanager.cz)",
|
||||
"WeCom": "WeCom",
|
||||
"ServerChan": "ServerChan",
|
||||
}
|
||||
|
||||
|
||||
def build_notification_providers(root):
|
||||
providers = []
|
||||
for path in glob.glob(f'{root}/server/notification-providers/*'):
|
||||
providers = {}
|
||||
|
||||
# get providers and input names
|
||||
for path in sorted(glob.glob(f'{root}/server/notification-providers/*')):
|
||||
with open(path) as f:
|
||||
content = f.read()
|
||||
match = re.search(r'class [^ ]+ extends NotificationProvider {', content)
|
||||
|
@ -16,19 +91,19 @@ def build_notification_providers(root):
|
|||
match = re.search(r'name = "([^"]+)";', content)
|
||||
name = match.group(1)
|
||||
|
||||
inputs = re.findall(r'notification\.([^ ,.;})\]]+)', content)
|
||||
inputs = re.findall(r'notification\??\.([^ ,.;})\]]+)', content)
|
||||
inputs = deduplicate_list(inputs)
|
||||
inputs = [i.strip() for i in inputs]
|
||||
|
||||
providers.append({
|
||||
"name": name,
|
||||
"inputs": inputs,
|
||||
})
|
||||
return providers
|
||||
providers[name] = {
|
||||
"title": titles.get(name, name),
|
||||
"inputs": {},
|
||||
}
|
||||
for input_ in inputs:
|
||||
if input_ not in ignored_inputs.get(name, []):
|
||||
providers[name]["inputs"][input_] = {}
|
||||
|
||||
|
||||
def build_notification_provider_conditions(root):
|
||||
conditions = {}
|
||||
# get inputs
|
||||
for path in glob.glob(f'{root}/src/components/notifications/*'):
|
||||
if path.endswith("index.js"):
|
||||
continue
|
||||
|
@ -37,21 +112,49 @@ def build_notification_provider_conditions(root):
|
|||
match = re.search(r'<template>[\s\S]+</template>', content, re.MULTILINE)
|
||||
html = match.group(0)
|
||||
soup = BeautifulSoup(html, "html.parser")
|
||||
inputs = soup.find_all("input")
|
||||
for input in inputs:
|
||||
condition = {}
|
||||
attrs = input.attrs
|
||||
inputs = soup.find_all(attrs={"v-model": True})
|
||||
for input_ in inputs:
|
||||
conditions = {}
|
||||
attrs = input_.attrs
|
||||
v_model = attrs.get("v-model")
|
||||
min_ = attrs.get("min")
|
||||
max_ = attrs.get("max")
|
||||
if min_:
|
||||
condition["min"] = int(min_)
|
||||
if max_:
|
||||
condition["max"] = int(max_)
|
||||
param_name = re.match(r'\$parent.notification.(.*)$', v_model).group(1)
|
||||
if condition:
|
||||
conditions[param_name] = condition
|
||||
return conditions
|
||||
|
||||
type_ = attrs.get("type")
|
||||
if type_ == "number":
|
||||
type_ = "int"
|
||||
elif type_ == "checkbox":
|
||||
type_ = "bool"
|
||||
else:
|
||||
type_ = "str"
|
||||
|
||||
required_true_values = ['', 'true']
|
||||
if attrs.get("required") in required_true_values or attrs.get(":required") in required_true_values:
|
||||
required = True
|
||||
else:
|
||||
required = False
|
||||
|
||||
min_ = attrs.get("min")
|
||||
if min_:
|
||||
conditions["min"] = int(min_)
|
||||
|
||||
max_ = attrs.get("max")
|
||||
if max_:
|
||||
conditions["max"] = int(max_)
|
||||
|
||||
# find provider inputs dict
|
||||
input_found = False
|
||||
for name in list(providers.keys()):
|
||||
inputs = providers[name]["inputs"]
|
||||
for provider_input in inputs:
|
||||
if provider_input == param_name:
|
||||
input_found = True
|
||||
providers[name]["inputs"][provider_input] = {
|
||||
"conditions": conditions,
|
||||
"type": type_,
|
||||
"required": required
|
||||
}
|
||||
assert input_found
|
||||
return providers
|
||||
|
||||
|
||||
def diff(old, new):
|
||||
|
@ -64,16 +167,25 @@ def diff(old, new):
|
|||
print("")
|
||||
|
||||
|
||||
# write_to_file(
|
||||
# "notification_providers.py.j2", "./../uptime_kuma_api/notification_providers.py",
|
||||
# notification_providers=notification_providers,
|
||||
# notification_provider_conditions=notification_provider_conditions
|
||||
# )
|
||||
notification_providers = build_notification_providers("uptime-kuma")
|
||||
|
||||
notification_providers_old = build_notification_providers("uptime-kuma-old")
|
||||
notification_providers_new = build_notification_providers("uptime-kuma")
|
||||
diff(notification_providers_old, notification_providers_new)
|
||||
notification_provider_conditions = {}
|
||||
for notification_provider in notification_providers:
|
||||
for notification_provider_input_name in notification_providers[notification_provider]["inputs"]:
|
||||
notification_provider_input = notification_providers[notification_provider]["inputs"][notification_provider_input_name]
|
||||
if notification_provider_input["conditions"]:
|
||||
notification_provider_conditions[notification_provider_input_name] = notification_provider_input["conditions"]
|
||||
|
||||
notification_provider_conditions_old = build_notification_provider_conditions("uptime-kuma-old")
|
||||
notification_provider_conditions_new = build_notification_provider_conditions("uptime-kuma")
|
||||
diff(notification_provider_conditions_old, notification_provider_conditions_new)
|
||||
write_to_file(
|
||||
"notification_providers.py.j2", "./../uptime_kuma_api/notification_providers.py",
|
||||
notification_providers=notification_providers,
|
||||
notification_provider_conditions=notification_provider_conditions
|
||||
)
|
||||
|
||||
# notification_providers_old = build_notification_providers("uptime-kuma-old")
|
||||
# notification_providers_new = build_notification_providers("uptime-kuma")
|
||||
# diff(notification_providers_old, notification_providers_new)
|
||||
#
|
||||
# notification_provider_conditions_old = build_notification_provider_conditions("uptime-kuma-old")
|
||||
# notification_provider_conditions_new = build_notification_provider_conditions("uptime-kuma")
|
||||
# diff(notification_provider_conditions_old, notification_provider_conditions_new)
|
||||
|
|
|
@ -2,30 +2,30 @@ from enum import Enum
|
|||
|
||||
|
||||
class NotificationType(str, Enum):
|
||||
{%- for notification_provider in notification_providers %}
|
||||
{%- set name = notification_provider["name"] %}
|
||||
{{ name.upper().replace(".", "_") }} = "{{ name }}"
|
||||
{%- endfor %}
|
||||
|
||||
"""Enumerate notification types."""
|
||||
{% for provider in notification_providers %}
|
||||
{{ provider.upper().replace(".", "_") }} = "{{ provider }}"
|
||||
"""{{ notification_providers[provider]["title"] }}"""
|
||||
{% endfor %}
|
||||
|
||||
notification_provider_options = {
|
||||
{%- for notification_provider in notification_providers %}
|
||||
{%- set name = notification_provider["name"] %}
|
||||
NotificationType.{{ name.upper().replace(".", "_") }}: [
|
||||
{%- for input in notification_provider["inputs"] %}
|
||||
"{{ input }}",
|
||||
{%- 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"] }}),
|
||||
{%- endfor %}
|
||||
],
|
||||
),
|
||||
{%- endfor %}
|
||||
}
|
||||
|
||||
notification_provider_conditions = {
|
||||
notification_provider_conditions = dict(
|
||||
{%- for provider in notification_provider_conditions %}
|
||||
"{{ provider }}": {
|
||||
{{ provider }}=dict(
|
||||
{%- for key, value in notification_provider_conditions[provider].items() %}
|
||||
"{{ key }}": {{ value }},
|
||||
{{ key }}={{ value }},
|
||||
{%- endfor %}
|
||||
},
|
||||
),
|
||||
{%- endfor %}
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -304,10 +304,9 @@ def _check_arguments_notification(kwargs) -> None:
|
|||
required_args = ["type", "name"]
|
||||
_check_missing_arguments(required_args, kwargs)
|
||||
|
||||
# TODO: collect required notification args from /src/components/notifications/*
|
||||
# type_ = kwargs["type"]
|
||||
# required_args = notification_provider_options[type_]
|
||||
# _check_missing_arguments(required_args, kwargs)
|
||||
type_ = kwargs["type"]
|
||||
required_args = notification_provider_options[type_]
|
||||
_check_missing_arguments(required_args, kwargs)
|
||||
_check_argument_conditions(notification_provider_conditions, kwargs)
|
||||
|
||||
|
||||
|
|
|
@ -7,12 +7,18 @@ class NotificationType(str, Enum):
|
|||
ALERTA = "alerta"
|
||||
"""Alerta"""
|
||||
|
||||
ALERTNOW = "AlertNow"
|
||||
"""AlertNow"""
|
||||
|
||||
ALIYUNSMS = "AliyunSMS"
|
||||
"""AliyunSMS"""
|
||||
|
||||
APPRISE = "apprise"
|
||||
"""Apprise (Support 50+ Notification services)"""
|
||||
|
||||
BARK = "Bark"
|
||||
"""Bark"""
|
||||
|
||||
CLICKSENDSMS = "clicksendsms"
|
||||
"""ClickSend SMS"""
|
||||
|
||||
|
@ -25,8 +31,14 @@ class NotificationType(str, Enum):
|
|||
FEISHU = "Feishu"
|
||||
"""Feishu"""
|
||||
|
||||
FREEMOBILE = "FreeMobile"
|
||||
"""FreeMobile (mobile.free.fr)"""
|
||||
|
||||
GOALERT = "GoAlert"
|
||||
"""GoAlert"""
|
||||
|
||||
GOOGLECHAT = "GoogleChat"
|
||||
"""Google Chat (Google Workspace only)"""
|
||||
"""Google Chat (Google Workspace)"""
|
||||
|
||||
GORUSH = "gorush"
|
||||
"""Gorush"""
|
||||
|
@ -34,8 +46,17 @@ class NotificationType(str, Enum):
|
|||
GOTIFY = "gotify"
|
||||
"""Gotify"""
|
||||
|
||||
HOMEASSISTANT = "HomeAssistant"
|
||||
"""Home Assistant"""
|
||||
|
||||
KOOK = "Kook"
|
||||
"""Kook"""
|
||||
|
||||
LINE = "line"
|
||||
"""Line Messenger"""
|
||||
"""LINE Messenger"""
|
||||
|
||||
LINENOTIFY = "LineNotify"
|
||||
"""LINE Notify"""
|
||||
|
||||
LUNASEA = "lunasea"
|
||||
"""LunaSea"""
|
||||
|
@ -46,9 +67,18 @@ class NotificationType(str, Enum):
|
|||
MATTERMOST = "mattermost"
|
||||
"""Mattermost"""
|
||||
|
||||
NTFY = "ntfy"
|
||||
"""Ntfy"""
|
||||
|
||||
OCTOPUSH = "octopush"
|
||||
"""Octopush"""
|
||||
|
||||
ONEBOT = "OneBot"
|
||||
"""OneBot"""
|
||||
|
||||
OPSGENIE = "Opsgenie"
|
||||
"""Opsgenie"""
|
||||
|
||||
PAGERDUTY = "PagerDuty"
|
||||
"""PagerDuty"""
|
||||
|
||||
|
@ -73,6 +103,9 @@ class NotificationType(str, Enum):
|
|||
ROCKET_CHAT = "rocket.chat"
|
||||
"""Rocket.Chat"""
|
||||
|
||||
SERVERCHAN = "ServerChan"
|
||||
"""ServerChan"""
|
||||
|
||||
SERWERSMS = "serwersms"
|
||||
"""SerwerSMS.pl"""
|
||||
|
||||
|
@ -82,374 +115,333 @@ class NotificationType(str, Enum):
|
|||
SLACK = "slack"
|
||||
"""Slack"""
|
||||
|
||||
SMSEAGLE = "SMSEagle"
|
||||
"""SMSEagle"""
|
||||
|
||||
SMSMANAGER = "SMSManager"
|
||||
"""SmsManager (smsmanager.cz)"""
|
||||
|
||||
SMTP = "smtp"
|
||||
"""Email (SMTP)"""
|
||||
|
||||
SPLUNK = "Splunk"
|
||||
"""Splunk"""
|
||||
|
||||
SQUADCAST = "squadcast"
|
||||
"""SquadCast"""
|
||||
|
||||
STACKFIELD = "stackfield"
|
||||
"""Stackfield"""
|
||||
|
||||
TEAMS = "teams"
|
||||
"""Microsoft Teams"""
|
||||
|
||||
PUSHBYTECHULUS = "PushByTechulus"
|
||||
"""Push by Techulus"""
|
||||
|
||||
TELEGRAM = "telegram"
|
||||
"""Telegram"""
|
||||
|
||||
TWILIO = "twilio"
|
||||
"""Twilio"""
|
||||
|
||||
WEBHOOK = "webhook"
|
||||
"""Webhook"""
|
||||
|
||||
WECOM = "WeCom"
|
||||
"""WeCom"""
|
||||
|
||||
ALERTNOW = "AlertNow"
|
||||
"""AlertNow"""
|
||||
|
||||
HOMEASSISTANT = "HomeAssistant"
|
||||
"""Home Assistant"""
|
||||
|
||||
LINENOTIFY = "LineNotify"
|
||||
"""LineNotify"""
|
||||
|
||||
BARK = "Bark"
|
||||
"""Bark"""
|
||||
|
||||
GOALERT = "GoAlert"
|
||||
"""GoAlert"""
|
||||
|
||||
OCTOPUSH = "octopush"
|
||||
"""Octopush"""
|
||||
|
||||
SERVERCHAN = "ServerChan"
|
||||
"""ServerChan"""
|
||||
|
||||
SMSMANAGER = "SMSManager"
|
||||
"""SMSManager"""
|
||||
|
||||
SQUADCAST = "squadcast"
|
||||
"""Squadcast"""
|
||||
|
||||
TEAMS = "teams"
|
||||
"""Microsoft Teams"""
|
||||
|
||||
FREEMOBILE = "FreeMobile"
|
||||
"""FreeMobile"""
|
||||
|
||||
NTFY = "ntfy"
|
||||
"""ntfy"""
|
||||
|
||||
SMSEAGLE = "SMSEagle"
|
||||
"""SMSEagle"""
|
||||
|
||||
ZOHOCLIQ = "ZohoCliq"
|
||||
"""ZohoCliq"""
|
||||
|
||||
KOOK = "Kook"
|
||||
"""Kook"""
|
||||
|
||||
SPLUNK = "Splunk"
|
||||
"""Splunk"""
|
||||
|
||||
OPSGENIE = "Opsgenie"
|
||||
"""Opsgenie"""
|
||||
|
||||
TWILIO = "twilio"
|
||||
"""twilio"""
|
||||
|
||||
|
||||
notification_provider_options = {
|
||||
NotificationType.ALERTA: dict(
|
||||
alertaApiEndpoint=dict(
|
||||
type="str"
|
||||
),
|
||||
alertaApiKey=dict(type="str"),
|
||||
alertaEnvironment=dict(type="str"),
|
||||
alertaAlertState=dict(type="str"),
|
||||
alertaRecoverState=dict(type="str"),
|
||||
),
|
||||
NotificationType.ALIYUNSMS: dict(
|
||||
phonenumber=dict(type="str"),
|
||||
templateCode=dict(type="str"),
|
||||
signName=dict(type="str"),
|
||||
accessKeyId=dict(type="str"),
|
||||
secretAccessKey=dict(type="str"),
|
||||
),
|
||||
NotificationType.APPRISE: dict(
|
||||
appriseURL=dict(type="str"),
|
||||
title=dict(type="str"),
|
||||
),
|
||||
NotificationType.CLICKSENDSMS: dict(
|
||||
clicksendsmsLogin=dict(type="str"),
|
||||
clicksendsmsPassword=dict(type="str"),
|
||||
clicksendsmsToNumber=dict(type="str"),
|
||||
clicksendsmsSenderName=dict(type="str"),
|
||||
),
|
||||
NotificationType.DINGDING: dict(
|
||||
webHookUrl=dict(type="str"),
|
||||
secretKey=dict(type="str"),
|
||||
),
|
||||
NotificationType.DISCORD: dict(
|
||||
discordUsername=dict(type="str"),
|
||||
discordWebhookUrl=dict(type="str"),
|
||||
discordPrefixMessage=dict(type="str"),
|
||||
),
|
||||
NotificationType.FEISHU: dict(
|
||||
feishuWebHookUrl=dict(type="str"),
|
||||
),
|
||||
NotificationType.GOOGLECHAT: dict(
|
||||
googleChatWebhookURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.GORUSH: dict(
|
||||
gorushDeviceToken=dict(type="str"),
|
||||
gorushPlatform=dict(type="str"),
|
||||
gorushTitle=dict(type="str"),
|
||||
gorushPriority=dict(type="str"),
|
||||
gorushRetry=dict(type="str"),
|
||||
gorushTopic=dict(type="str"),
|
||||
gorushServerURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.GOTIFY: dict(
|
||||
gotifyserverurl=dict(type="str"),
|
||||
gotifyapplicationToken=dict(type="str"),
|
||||
gotifyPriority=dict(type="int"),
|
||||
),
|
||||
NotificationType.LINE: dict(
|
||||
lineChannelAccessToken=dict(type="str"),
|
||||
lineUserID=dict(type="str"),
|
||||
),
|
||||
NotificationType.LUNASEA: dict(
|
||||
lunaseaTarget=dict(type="str"),
|
||||
lunaseaUserID=dict(type="str"),
|
||||
lunaseaDevice=dict(type="str"),
|
||||
),
|
||||
NotificationType.MATRIX: dict(
|
||||
internalRoomId=dict(type="str"),
|
||||
accessToken=dict(type="str"),
|
||||
homeserverUrl=dict(type="str"),
|
||||
),
|
||||
NotificationType.MATTERMOST: dict(
|
||||
mattermostusername=dict(type="str"),
|
||||
mattermostWebhookUrl=dict(type="str"),
|
||||
mattermostchannel=dict(type="str"),
|
||||
mattermosticonemo=dict(type="str"),
|
||||
mattermosticonurl=dict(type="str"),
|
||||
),
|
||||
NotificationType.ONEBOT: dict(
|
||||
httpAddr=dict(type="str"),
|
||||
accessToken=dict(type="str"),
|
||||
msgType=dict(type="str"),
|
||||
recieverId=dict(type="str"),
|
||||
),
|
||||
NotificationType.PAGERDUTY: dict(
|
||||
pagerdutyAutoResolve=dict(type="str"),
|
||||
pagerdutyIntegrationUrl=dict(type="str"),
|
||||
pagerdutyPriority=dict(type="str"),
|
||||
pagerdutyIntegrationKey=dict(type="str"),
|
||||
),
|
||||
NotificationType.PAGERTREE: dict(
|
||||
pagertreeAutoResolve=dict(type="str"),
|
||||
pagertreeIntegrationUrl=dict(type="str"),
|
||||
pagertreeUrgency=dict(type="str"),
|
||||
),
|
||||
NotificationType.PROMOSMS: dict(
|
||||
promosmsLogin=dict(type="str"),
|
||||
promosmsPassword=dict(type="str"),
|
||||
promosmsPhoneNumber=dict(type="str"),
|
||||
promosmsSMSType=dict(type="str"),
|
||||
promosmsSenderName=dict(type="str"),
|
||||
promosmsAllowLongSMS=dict(type="bool"),
|
||||
),
|
||||
NotificationType.PUSHBULLET: dict(
|
||||
pushbulletAccessToken=dict(type="str"),
|
||||
),
|
||||
NotificationType.PUSHDEER: dict(
|
||||
pushdeerKey=dict(type="str"),
|
||||
),
|
||||
NotificationType.PUSHOVER: dict(
|
||||
pushoveruserkey=dict(type="str"),
|
||||
pushoverapptoken=dict(type="str"),
|
||||
pushoversounds=dict(type="str"),
|
||||
pushoverpriority=dict(type="str"),
|
||||
pushovertitle=dict(type="str"),
|
||||
pushoverdevice=dict(type="str"),
|
||||
),
|
||||
NotificationType.PUSHY: dict(
|
||||
pushyAPIKey=dict(type="str"),
|
||||
pushyToken=dict(type="str"),
|
||||
),
|
||||
NotificationType.ROCKET_CHAT: dict(
|
||||
rocketchannel=dict(type="str"),
|
||||
rocketusername=dict(type="str"),
|
||||
rocketiconemo=dict(type="str"),
|
||||
rocketwebhookURL=dict(type="str"),
|
||||
rocketbutton=dict(type="str"),
|
||||
),
|
||||
NotificationType.SERWERSMS: dict(
|
||||
serwersmsUsername=dict(type="str"),
|
||||
serwersmsPassword=dict(type="str"),
|
||||
serwersmsPhoneNumber=dict(type="str"),
|
||||
serwersmsSenderName=dict(type="str"),
|
||||
),
|
||||
NotificationType.SIGNAL: dict(
|
||||
signalNumber=dict(type="str"),
|
||||
signalRecipients=dict(type="str"),
|
||||
signalURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.SLACK: dict(
|
||||
slackbutton=dict(type="str"),
|
||||
slackchannel=dict(type="str"),
|
||||
slackusername=dict(type="str"),
|
||||
slackiconemo=dict(type="str"),
|
||||
slackwebhookURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.SMTP: dict(
|
||||
smtpHost=dict(type="str"),
|
||||
smtpPort=dict(type="int"),
|
||||
smtpSecure=dict(type="str"),
|
||||
smtpIgnoreTLSError=dict(type="str"),
|
||||
smtpDkimDomain=dict(type="str"),
|
||||
smtpDkimKeySelector=dict(type="str"),
|
||||
smtpDkimPrivateKey=dict(type="str"),
|
||||
smtpDkimHashAlgo=dict(type="str"),
|
||||
smtpDkimheaderFieldNames=dict(type="str"),
|
||||
smtpDkimskipFields=dict(type="str"),
|
||||
smtpUsername=dict(type="str"),
|
||||
smtpPassword=dict(type="str"),
|
||||
customSubject=dict(type="str"),
|
||||
smtpFrom=dict(type="str"),
|
||||
smtpCC=dict(type="str"),
|
||||
smtpBCC=dict(type="str"),
|
||||
smtpTo=dict(type="str"),
|
||||
),
|
||||
NotificationType.STACKFIELD: dict(
|
||||
stackfieldwebhookURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.PUSHBYTECHULUS: dict(
|
||||
pushAPIKey=dict(type="str"),
|
||||
),
|
||||
NotificationType.TELEGRAM: dict(
|
||||
telegramChatID=dict(type="str"),
|
||||
telegramSendSilently=dict(type="bool"),
|
||||
telegramProtectContent=dict(type="bool"),
|
||||
telegramMessageThreadID=dict(type="str"),
|
||||
telegramBotToken=dict(type="str"),
|
||||
),
|
||||
NotificationType.WEBHOOK: dict(
|
||||
webhookContentType=dict(type="str"),
|
||||
webhookAdditionalHeaders=dict(type="str"),
|
||||
webhookURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.WECOM: dict(
|
||||
weComBotKey=dict(type="str"),
|
||||
alertaApiEndpoint=dict(type="str", required=True),
|
||||
alertaApiKey=dict(type="str", required=True),
|
||||
alertaEnvironment=dict(type="str", required=True),
|
||||
alertaAlertState=dict(type="str", required=True),
|
||||
alertaRecoverState=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.ALERTNOW: dict(
|
||||
alertNowWebhookURL=dict(type="str"),
|
||||
alertNowWebhookURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.HOMEASSISTANT: dict(
|
||||
homeAssistantUrl=dict(type="str"),
|
||||
longLivedAccessToken=dict(type="str"),
|
||||
NotificationType.ALIYUNSMS: dict(
|
||||
phonenumber=dict(type="str", required=True),
|
||||
templateCode=dict(type="str", required=True),
|
||||
signName=dict(type="str", required=True),
|
||||
accessKeyId=dict(type="str", required=True),
|
||||
secretAccessKey=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.LINENOTIFY: dict(
|
||||
lineNotifyAccessToken=dict(type="str"),
|
||||
NotificationType.APPRISE: dict(
|
||||
appriseURL=dict(type="str", required=True),
|
||||
title=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.BARK: dict(
|
||||
barkEndpoint=dict(type="str"),
|
||||
barkGroup=dict(type="str"),
|
||||
barkSound=dict(type="str"),
|
||||
barkEndpoint=dict(type="str", required=True),
|
||||
barkGroup=dict(type="str", required=True),
|
||||
barkSound=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.GOALERT: dict(
|
||||
goAlertBaseURL=dict(type="str"),
|
||||
goAlertToken=dict(type="str"),
|
||||
NotificationType.CLICKSENDSMS: dict(
|
||||
clicksendsmsLogin=dict(type="str", required=True),
|
||||
clicksendsmsPassword=dict(type="str", required=True),
|
||||
clicksendsmsToNumber=dict(type="str", required=True),
|
||||
clicksendsmsSenderName=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.OCTOPUSH: dict(
|
||||
octopushVersion=dict(type="str"),
|
||||
octopushAPIKey=dict(type="str"),
|
||||
octopushLogin=dict(type="str"),
|
||||
octopushPhoneNumber=dict(type="str"),
|
||||
octopushSMSType=dict(type="str"),
|
||||
octopushSenderName=dict(type="str"),
|
||||
octopushDMLogin=dict(type="str"),
|
||||
octopushDMAPIKey=dict(type="str"),
|
||||
octopushDMPhoneNumber=dict(type="str"),
|
||||
octopushDMSenderName=dict(type="str"),
|
||||
octopushDMSMSType=dict(type="str"),
|
||||
NotificationType.DINGDING: dict(
|
||||
webHookUrl=dict(type="str", required=True),
|
||||
secretKey=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SERVERCHAN: dict(
|
||||
serverChanSendKey=dict(type="str"),
|
||||
NotificationType.DISCORD: dict(
|
||||
discordUsername=dict(type="str", required=False),
|
||||
discordWebhookUrl=dict(type="str", required=True),
|
||||
discordPrefixMessage=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.SMSMANAGER: dict(
|
||||
smsmanagerApiKey=dict(type="str"),
|
||||
numbers=dict(type="str"),
|
||||
messageType=dict(type="str"),
|
||||
),
|
||||
NotificationType.SQUADCAST: dict(
|
||||
squadcastWebhookURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.TEAMS: dict(
|
||||
webhookUrl=dict(type="str"),
|
||||
NotificationType.FEISHU: dict(
|
||||
feishuWebHookUrl=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.FREEMOBILE: dict(
|
||||
freemobileUser=dict(type="str"),
|
||||
freemobilePass=dict(type="str"),
|
||||
freemobileUser=dict(type="str", required=True),
|
||||
freemobilePass=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.NTFY: dict(
|
||||
ntfyusername=dict(type="str"),
|
||||
ntfypassword=dict(type="str"),
|
||||
ntfytopic=dict(type="str"),
|
||||
ntfyPriority=dict(type="int"),
|
||||
ntfyIcon=dict(type="str"),
|
||||
ntfyserverurl=dict(type="str"),
|
||||
NotificationType.GOALERT: dict(
|
||||
goAlertBaseURL=dict(type="str", required=True),
|
||||
goAlertToken=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SMSEAGLE: dict(
|
||||
smseagleEncoding=dict(type="bool"),
|
||||
smseaglePriority=dict(type="int"),
|
||||
smseagleRecipientType=dict(type="str"),
|
||||
smseagleToken=dict(type="str"),
|
||||
smseagleRecipient=dict(type="str"),
|
||||
smseagleUrl=dict(type="str")
|
||||
NotificationType.GOOGLECHAT: dict(
|
||||
googleChatWebhookURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.ZOHOCLIQ: dict(
|
||||
webhookUrl=dict(type="str")
|
||||
NotificationType.GORUSH: dict(
|
||||
gorushDeviceToken=dict(type="str", required=True),
|
||||
gorushPlatform=dict(type="str", required=False),
|
||||
gorushTitle=dict(type="str", required=False),
|
||||
gorushPriority=dict(type="str", required=False),
|
||||
gorushRetry=dict(type="int", required=False),
|
||||
gorushTopic=dict(type="str", required=False),
|
||||
gorushServerURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.GOTIFY: dict(
|
||||
gotifyserverurl=dict(type="str", required=True),
|
||||
gotifyapplicationToken=dict(type="str", required=True),
|
||||
gotifyPriority=dict(type="int", required=True),
|
||||
),
|
||||
NotificationType.HOMEASSISTANT: dict(
|
||||
notificationService=dict(type="str", required=False),
|
||||
homeAssistantUrl=dict(type="str", required=True),
|
||||
longLivedAccessToken=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.KOOK: dict(
|
||||
kookGuildID=dict(type="str"),
|
||||
kookBotToken=dict(type="str")
|
||||
kookGuildID=dict(type="str", required=True),
|
||||
kookBotToken=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SPLUNK: dict(
|
||||
splunkAutoResolve=dict(type="str"),
|
||||
splunkSeverity=dict(type="str"),
|
||||
splunkRestURL=dict(type="str")
|
||||
NotificationType.LINE: dict(
|
||||
lineChannelAccessToken=dict(type="str", required=True),
|
||||
lineUserID=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.LINENOTIFY: dict(
|
||||
lineNotifyAccessToken=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.LUNASEA: dict(
|
||||
lunaseaTarget=dict(type="str", required=True),
|
||||
lunaseaUserID=dict(type="str", required=False),
|
||||
lunaseaDevice=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.MATRIX: dict(
|
||||
internalRoomId=dict(type="str", required=True),
|
||||
accessToken=dict(type="str", required=True),
|
||||
homeserverUrl=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.MATTERMOST: dict(
|
||||
mattermostusername=dict(type="str", required=False),
|
||||
mattermostWebhookUrl=dict(type="str", required=True),
|
||||
mattermostchannel=dict(type="str", required=False),
|
||||
mattermosticonemo=dict(type="str", required=False),
|
||||
mattermosticonurl=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.NTFY: dict(
|
||||
ntfyusername=dict(type="str", required=False),
|
||||
ntfypassword=dict(type="str", required=False),
|
||||
ntfytopic=dict(type="str", required=True),
|
||||
ntfyPriority=dict(type="int", required=True),
|
||||
ntfyIcon=dict(type="str", required=False),
|
||||
ntfyserverurl=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.OCTOPUSH: dict(
|
||||
octopushVersion=dict(type="str", required=False),
|
||||
octopushAPIKey=dict(type="str", required=True),
|
||||
octopushLogin=dict(type="str", required=True),
|
||||
octopushPhoneNumber=dict(type="str", required=True),
|
||||
octopushSMSType=dict(type="str", required=False),
|
||||
octopushSenderName=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.ONEBOT: dict(
|
||||
httpAddr=dict(type="str", required=True),
|
||||
accessToken=dict(type="str", required=True),
|
||||
msgType=dict(type="str", required=False),
|
||||
recieverId=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.OPSGENIE: dict(
|
||||
opsgeniePriority=dict(type="int"),
|
||||
opsgenieRegion=dict(type="str"),
|
||||
opsgenieApiKey=dict(type="str")
|
||||
opsgeniePriority=dict(type="int", required=False),
|
||||
opsgenieRegion=dict(type="str", required=True),
|
||||
opsgenieApiKey=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.PAGERDUTY: dict(
|
||||
pagerdutyAutoResolve=dict(type="str", required=False),
|
||||
pagerdutyIntegrationUrl=dict(type="str", required=False),
|
||||
pagerdutyPriority=dict(type="str", required=False),
|
||||
pagerdutyIntegrationKey=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.PAGERTREE: dict(
|
||||
pagertreeAutoResolve=dict(type="str", required=False),
|
||||
pagertreeIntegrationUrl=dict(type="str", required=False),
|
||||
pagertreeUrgency=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.PROMOSMS: dict(
|
||||
promosmsAllowLongSMS=dict(type="bool", required=False),
|
||||
promosmsLogin=dict(type="str", required=True),
|
||||
promosmsPassword=dict(type="str", required=True),
|
||||
promosmsPhoneNumber=dict(type="str", required=True),
|
||||
promosmsSMSType=dict(type="str", required=False),
|
||||
promosmsSenderName=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.PUSHBULLET: dict(
|
||||
pushbulletAccessToken=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.PUSHDEER: dict(
|
||||
pushdeerKey=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.PUSHOVER: dict(
|
||||
pushoveruserkey=dict(type="str", required=True),
|
||||
pushoverapptoken=dict(type="str", required=True),
|
||||
pushoversounds=dict(type="str", required=False),
|
||||
pushoverpriority=dict(type="str", required=False),
|
||||
pushovertitle=dict(type="str", required=False),
|
||||
pushoverdevice=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.PUSHY: dict(
|
||||
pushyAPIKey=dict(type="str", required=True),
|
||||
pushyToken=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.ROCKET_CHAT: dict(
|
||||
rocketchannel=dict(type="str", required=False),
|
||||
rocketusername=dict(type="str", required=False),
|
||||
rocketiconemo=dict(type="str", required=False),
|
||||
rocketwebhookURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SERVERCHAN: dict(
|
||||
serverChanSendKey=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SERWERSMS: dict(
|
||||
serwersmsUsername=dict(type="str", required=True),
|
||||
serwersmsPassword=dict(type="str", required=True),
|
||||
serwersmsPhoneNumber=dict(type="str", required=True),
|
||||
serwersmsSenderName=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.SIGNAL: dict(
|
||||
signalNumber=dict(type="str", required=True),
|
||||
signalRecipients=dict(type="str", required=True),
|
||||
signalURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SLACK: dict(
|
||||
slackchannel=dict(type="str", required=False),
|
||||
slackusername=dict(type="str", required=False),
|
||||
slackiconemo=dict(type="str", required=False),
|
||||
slackwebhookURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SMSEAGLE: dict(
|
||||
smseagleEncoding=dict(type="bool", required=False),
|
||||
smseaglePriority=dict(type="int", required=False),
|
||||
smseagleRecipientType=dict(type="str", required=False),
|
||||
smseagleToken=dict(type="str", required=True),
|
||||
smseagleRecipient=dict(type="str", required=True),
|
||||
smseagleUrl=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SMSMANAGER: dict(
|
||||
smsmanagerApiKey=dict(type="str", required=False),
|
||||
numbers=dict(type="str", required=False),
|
||||
messageType=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.SMTP: dict(
|
||||
smtpHost=dict(type="str", required=True),
|
||||
smtpPort=dict(type="int", required=True),
|
||||
smtpSecure=dict(type="str", required=False),
|
||||
smtpIgnoreTLSError=dict(type="bool", required=False),
|
||||
smtpDkimDomain=dict(type="str", required=False),
|
||||
smtpDkimKeySelector=dict(type="str", required=False),
|
||||
smtpDkimPrivateKey=dict(type="str", required=False),
|
||||
smtpDkimHashAlgo=dict(type="str", required=False),
|
||||
smtpDkimheaderFieldNames=dict(type="str", required=False),
|
||||
smtpDkimskipFields=dict(type="str", required=False),
|
||||
smtpUsername=dict(type="str", required=False),
|
||||
smtpPassword=dict(type="str", required=False),
|
||||
customSubject=dict(type="str", required=False),
|
||||
smtpFrom=dict(type="str", required=True),
|
||||
smtpCC=dict(type="str", required=False),
|
||||
smtpBCC=dict(type="str", required=False),
|
||||
smtpTo=dict(type="str", required=False),
|
||||
),
|
||||
NotificationType.SPLUNK: dict(
|
||||
splunkAutoResolve=dict(type="str", required=False),
|
||||
splunkSeverity=dict(type="str", required=False),
|
||||
splunkRestURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.SQUADCAST: dict(
|
||||
squadcastWebhookURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.STACKFIELD: dict(
|
||||
stackfieldwebhookURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.TEAMS: dict(
|
||||
webhookUrl=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.PUSHBYTECHULUS: dict(
|
||||
pushAPIKey=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.TELEGRAM: dict(
|
||||
telegramChatID=dict(type="str", required=True),
|
||||
telegramSendSilently=dict(type="bool", required=False),
|
||||
telegramProtectContent=dict(type="bool", required=False),
|
||||
telegramMessageThreadID=dict(type="str", required=False),
|
||||
telegramBotToken=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.TWILIO: dict(
|
||||
twilioAccountSID=dict(type="str"),
|
||||
twilioAuthToken=dict(type="str"),
|
||||
twilioToNumber=dict(type="str"),
|
||||
twilioFromNumber=dict(type="str")
|
||||
)
|
||||
twilioAccountSID=dict(type="str", required=True),
|
||||
twilioAuthToken=dict(type="str", required=True),
|
||||
twilioToNumber=dict(type="str", required=True),
|
||||
twilioFromNumber=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.WEBHOOK: dict(
|
||||
webhookContentType=dict(type="str", required=True),
|
||||
webhookAdditionalHeaders=dict(type="str", required=False),
|
||||
webhookURL=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.WECOM: dict(
|
||||
weComBotKey=dict(type="str", required=True),
|
||||
),
|
||||
NotificationType.ZOHOCLIQ: dict(
|
||||
webhookUrl=dict(type="str", required=True),
|
||||
),
|
||||
}
|
||||
|
||||
notification_provider_conditions = dict(
|
||||
gotifyPriority=dict(
|
||||
min=0,
|
||||
max=10
|
||||
),
|
||||
smtpPort=dict(
|
||||
min=0,
|
||||
max=65535
|
||||
max=10,
|
||||
),
|
||||
ntfyPriority=dict(
|
||||
min=1,
|
||||
max=5
|
||||
),
|
||||
smseaglePriority=dict(
|
||||
min=0,
|
||||
max=9
|
||||
max=5,
|
||||
),
|
||||
opsgeniePriority=dict(
|
||||
min=1,
|
||||
max=5
|
||||
)
|
||||
max=5,
|
||||
),
|
||||
smseaglePriority=dict(
|
||||
min=0,
|
||||
max=9,
|
||||
),
|
||||
smtpPort=dict(
|
||||
min=0,
|
||||
max=65535,
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue