fix: add type to notification provider options
This commit is contained in:
parent
3c17b2bf16
commit
dac368e2a5
2 changed files with 267 additions and 266 deletions
|
@ -222,24 +222,24 @@ def _check_arguments_monitor(kwargs):
|
|||
required_args = required_args_by_type[type_]
|
||||
_check_missing_arguments(required_args, kwargs)
|
||||
|
||||
conditions = {
|
||||
"interval": {
|
||||
"min": 20
|
||||
},
|
||||
"maxretries": {
|
||||
"min": 0
|
||||
},
|
||||
"retryInterval": {
|
||||
"min": 20
|
||||
},
|
||||
"maxredirects": {
|
||||
"min": 0
|
||||
},
|
||||
"port": {
|
||||
"min": 0,
|
||||
"max": 65535
|
||||
}
|
||||
}
|
||||
conditions = dict(
|
||||
interval=dict(
|
||||
min=20,
|
||||
),
|
||||
maxretries=dict(
|
||||
min=0,
|
||||
),
|
||||
retryInterval=dict(
|
||||
min=20,
|
||||
),
|
||||
maxredirects=dict(
|
||||
min=0,
|
||||
),
|
||||
port=dict(
|
||||
min=0,
|
||||
max=65535,
|
||||
),
|
||||
)
|
||||
_check_argument_conditions(conditions, kwargs)
|
||||
|
||||
|
||||
|
@ -260,12 +260,12 @@ def _check_arguments_proxy(kwargs):
|
|||
required_args.extend(["username", "password"])
|
||||
_check_missing_arguments(required_args, kwargs)
|
||||
|
||||
conditions = {
|
||||
"port": {
|
||||
"min": 0,
|
||||
"max": 65535
|
||||
}
|
||||
}
|
||||
conditions = dict(
|
||||
port=dict(
|
||||
min=0,
|
||||
max=65535,
|
||||
)
|
||||
)
|
||||
_check_argument_conditions(conditions, kwargs)
|
||||
|
||||
|
||||
|
|
|
@ -48,247 +48,248 @@ class NotificationType(str, Enum):
|
|||
|
||||
|
||||
notification_provider_options = {
|
||||
NotificationType.ALERTA: [
|
||||
"alertaApiEndpoint",
|
||||
"alertaApiKey",
|
||||
"alertaEnvironment",
|
||||
"alertaAlertState",
|
||||
"alertaRecoverState",
|
||||
],
|
||||
NotificationType.ALIYUNSMS: [
|
||||
"phonenumber",
|
||||
"templateCode",
|
||||
"signName",
|
||||
"accessKeyId",
|
||||
"secretAccessKey",
|
||||
],
|
||||
NotificationType.APPRISE: [
|
||||
"appriseURL",
|
||||
"title",
|
||||
],
|
||||
NotificationType.CLICKSENDSMS: [
|
||||
"clicksendsmsLogin",
|
||||
"clicksendsmsPassword",
|
||||
"clicksendsmsToNumber",
|
||||
"clicksendsmsSenderName",
|
||||
],
|
||||
NotificationType.DINGDING: [
|
||||
"webHookUrl",
|
||||
"secretKey",
|
||||
],
|
||||
NotificationType.DISCORD: [
|
||||
"discordUsername",
|
||||
"discordWebhookUrl",
|
||||
"discordPrefixMessage",
|
||||
],
|
||||
NotificationType.FEISHU: [
|
||||
"feishuWebHookUrl",
|
||||
],
|
||||
NotificationType.GOOGLECHAT: [
|
||||
"googleChatWebhookURL",
|
||||
],
|
||||
NotificationType.GORUSH: [
|
||||
"gorushDeviceToken",
|
||||
"gorushPlatform",
|
||||
"gorushTitle",
|
||||
"gorushPriority",
|
||||
"gorushRetry",
|
||||
"gorushTopic",
|
||||
"gorushServerURL",
|
||||
],
|
||||
NotificationType.GOTIFY: [
|
||||
"gotifyserverurl",
|
||||
"gotifyapplicationToken",
|
||||
"gotifyPriority",
|
||||
],
|
||||
NotificationType.LINE: [
|
||||
"lineChannelAccessToken",
|
||||
"lineUserID",
|
||||
],
|
||||
NotificationType.LUNASEA: [
|
||||
"lunaseaDevice",
|
||||
],
|
||||
NotificationType.MATRIX: [
|
||||
"internalRoomId",
|
||||
"accessToken",
|
||||
"homeserverUrl",
|
||||
],
|
||||
NotificationType.MATTERMOST: [
|
||||
"mattermostusername",
|
||||
"mattermostWebhookUrl",
|
||||
"mattermostchannel",
|
||||
"mattermosticonemo",
|
||||
"mattermosticonurl",
|
||||
],
|
||||
NotificationType.ONEBOT: [
|
||||
"httpAddr",
|
||||
"accessToken",
|
||||
"msgType",
|
||||
"recieverId",
|
||||
],
|
||||
NotificationType.PAGERDUTY: [
|
||||
"pagerdutyAutoResolve",
|
||||
"pagerdutyIntegrationUrl",
|
||||
"pagerdutyPriority",
|
||||
"pagerdutyIntegrationKey",
|
||||
],
|
||||
NotificationType.PROMOSMS: [
|
||||
"promosmsLogin",
|
||||
"promosmsPassword",
|
||||
"promosmsPhoneNumber",
|
||||
"promosmsSMSType",
|
||||
"promosmsSenderName",
|
||||
],
|
||||
NotificationType.PUSHBULLET: [
|
||||
"pushbulletAccessToken",
|
||||
],
|
||||
NotificationType.PUSHDEER: [
|
||||
"pushdeerKey",
|
||||
],
|
||||
NotificationType.PUSHOVER: [
|
||||
"pushoveruserkey",
|
||||
"pushoverapptoken",
|
||||
"pushoversounds",
|
||||
"pushoverpriority",
|
||||
"pushovertitle",
|
||||
"pushoverdevice",
|
||||
],
|
||||
NotificationType.PUSHY: [
|
||||
"pushyAPIKey",
|
||||
"pushyToken",
|
||||
],
|
||||
NotificationType.ROCKET_CHAT: [
|
||||
"rocketchannel",
|
||||
"rocketusername",
|
||||
"rocketiconemo",
|
||||
"rocketwebhookURL",
|
||||
"rocketbutton",
|
||||
],
|
||||
NotificationType.SERWERSMS: [
|
||||
"serwersmsUsername",
|
||||
"serwersmsPassword",
|
||||
"serwersmsPhoneNumber",
|
||||
"serwersmsSenderName",
|
||||
],
|
||||
NotificationType.SIGNAL: [
|
||||
"signalNumber",
|
||||
"signalRecipients",
|
||||
"signalURL",
|
||||
],
|
||||
NotificationType.SLACK: [
|
||||
"slackbutton",
|
||||
"slackchannel",
|
||||
"slackusername",
|
||||
"slackiconemo",
|
||||
"slackwebhookURL",
|
||||
"slackbutton",
|
||||
],
|
||||
NotificationType.SMTP: [
|
||||
"smtpHost",
|
||||
"smtpPort",
|
||||
"smtpSecure",
|
||||
"smtpIgnoreTLSError",
|
||||
"smtpDkimDomain",
|
||||
"smtpDkimKeySelector",
|
||||
"smtpDkimPrivateKey",
|
||||
"smtpDkimHashAlgo",
|
||||
"smtpDkimheaderFieldNames",
|
||||
"smtpDkimskipFields",
|
||||
"smtpUsername",
|
||||
"smtpPassword",
|
||||
"customSubject",
|
||||
"smtpFrom",
|
||||
"smtpCC",
|
||||
"smtpBCC",
|
||||
"smtpTo",
|
||||
],
|
||||
NotificationType.STACKFIELD: [
|
||||
"stackfieldwebhookURL",
|
||||
],
|
||||
NotificationType.PUSHBYTECHULUS: [
|
||||
"pushAPIKey",
|
||||
],
|
||||
NotificationType.TELEGRAM: [
|
||||
"telegramBotToken",
|
||||
"telegramChatID",
|
||||
],
|
||||
NotificationType.WEBHOOK: [
|
||||
"webhookContentType",
|
||||
"webhookURL",
|
||||
],
|
||||
NotificationType.WECOM: [
|
||||
"weComBotKey",
|
||||
],
|
||||
NotificationType.ALERTNOW: [
|
||||
"alertNowWebhookURL",
|
||||
],
|
||||
NotificationType.HOMEASSISTANT: [
|
||||
"homeAssistantUrl",
|
||||
"longLivedAccessToken",
|
||||
],
|
||||
NotificationType.LINENOTIFY: [
|
||||
"lineNotifyAccessToken",
|
||||
],
|
||||
NotificationType.BARK: [
|
||||
"barkEndpoint",
|
||||
"barkGroup",
|
||||
"barkSound",
|
||||
],
|
||||
NotificationType.GOALERT: [
|
||||
"goAlertBaseURL",
|
||||
"goAlertToken",
|
||||
],
|
||||
NotificationType.OCTOPUSH: [
|
||||
"octopushVersion",
|
||||
"octopushAPIKey",
|
||||
"octopushLogin",
|
||||
"octopushPhoneNumber",
|
||||
"octopushSMSType",
|
||||
"octopushSenderName",
|
||||
"octopushDMLogin",
|
||||
"octopushDMAPIKey",
|
||||
"octopushDMPhoneNumber",
|
||||
"octopushDMSenderName",
|
||||
"octopushDMSMSType",
|
||||
],
|
||||
NotificationType.SERVERCHAN: [
|
||||
"serverChanSendKey",
|
||||
],
|
||||
NotificationType.SMSMANAGER: [
|
||||
"smsmanagerApiKey",
|
||||
"numbers",
|
||||
"messageType",
|
||||
],
|
||||
NotificationType.SQUADCAST: [
|
||||
"squadcastWebhookURL",
|
||||
],
|
||||
NotificationType.TEAMS: [
|
||||
"webhookUrl",
|
||||
],
|
||||
NotificationType.FREEMOBILE: [
|
||||
"freemobileUser",
|
||||
"freemobilePass",
|
||||
],
|
||||
NotificationType.NTFY: [
|
||||
"ntfyusername",
|
||||
"ntfypassword",
|
||||
"ntfytopic",
|
||||
"ntfyPriority",
|
||||
"ntfyserverurl",
|
||||
],
|
||||
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(
|
||||
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.PROMOSMS: dict(
|
||||
promosmsLogin=dict(type="str"),
|
||||
promosmsPassword=dict(type="str"),
|
||||
promosmsPhoneNumber=dict(type="str"),
|
||||
promosmsSMSType=dict(type="str"),
|
||||
promosmsSenderName=dict(type="str"),
|
||||
),
|
||||
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(
|
||||
telegramBotToken=dict(type="str"),
|
||||
telegramChatID=dict(type="str"),
|
||||
),
|
||||
NotificationType.WEBHOOK: dict(
|
||||
webhookContentType=dict(type="str"),
|
||||
webhookURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.WECOM: dict(
|
||||
weComBotKey=dict(type="str"),
|
||||
),
|
||||
NotificationType.ALERTNOW: dict(
|
||||
alertNowWebhookURL=dict(type="str"),
|
||||
),
|
||||
NotificationType.HOMEASSISTANT: dict(
|
||||
homeAssistantUrl=dict(type="str"),
|
||||
longLivedAccessToken=dict(type="str"),
|
||||
),
|
||||
NotificationType.LINENOTIFY: dict(
|
||||
lineNotifyAccessToken=dict(type="str"),
|
||||
),
|
||||
NotificationType.BARK: dict(
|
||||
barkEndpoint=dict(type="str"),
|
||||
barkGroup=dict(type="str"),
|
||||
barkSound=dict(type="str"),
|
||||
),
|
||||
NotificationType.GOALERT: dict(
|
||||
goAlertBaseURL=dict(type="str"),
|
||||
goAlertToken=dict(type="str"),
|
||||
),
|
||||
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.SERVERCHAN: dict(
|
||||
serverChanSendKey=dict(type="str"),
|
||||
),
|
||||
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.FREEMOBILE: dict(
|
||||
freemobileUser=dict(type="str"),
|
||||
freemobilePass=dict(type="str"),
|
||||
),
|
||||
NotificationType.NTFY: dict(
|
||||
ntfyusername=dict(type="str"),
|
||||
ntfypassword=dict(type="str"),
|
||||
ntfytopic=dict(type="str"),
|
||||
ntfyPriority=dict(type="int"),
|
||||
ntfyserverurl=dict(type="str"),
|
||||
),
|
||||
}
|
||||
|
||||
notification_provider_conditions = {
|
||||
"gotifyPriority": {
|
||||
"min": 0,
|
||||
"max": 10,
|
||||
},
|
||||
"smtpPort": {
|
||||
"min": 0,
|
||||
"max": 65535,
|
||||
},
|
||||
"ntfyPriority": {
|
||||
"min": 1,
|
||||
"max": 5,
|
||||
},
|
||||
}
|
||||
notification_provider_conditions = dict(
|
||||
gotifyPriority=dict(
|
||||
min=0,
|
||||
max=10
|
||||
),
|
||||
smtpPort=dict(
|
||||
min=0,
|
||||
max=65535
|
||||
),
|
||||
ntfyPriority=dict(
|
||||
min=1,
|
||||
max=5
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue