feat: add support for uptime kuma 1.19.5

This commit is contained in:
lucasheld 2023-01-17 21:01:55 +01:00
parent cc48b688da
commit 3e56459fb2
6 changed files with 47 additions and 8 deletions

View file

@ -8,7 +8,7 @@ This package was developed to configure Uptime Kuma with Ansible. The Ansible co
Python version 3.6+ is required. Python version 3.6+ is required.
Supported Uptime Kuma versions: 1.17.0 - 1.19.4 Supported Uptime Kuma versions: 1.17.0 - 1.19.5
Installation Installation
--- ---

View file

@ -5,7 +5,7 @@ if [ $version ]
then then
versions=("$version") versions=("$version")
else else
versions=(1.19.3 1.18.5 1.17.1) versions=(1.19.5 1.18.5 1.17.1)
fi fi
for version in ${versions[*]} for version in ${versions[*]}

View file

@ -4,4 +4,4 @@ for provider in notification_provider_options:
provider_options = notification_provider_options[provider] provider_options = notification_provider_options[provider]
for option in provider_options: for option in provider_options:
type_ = provider_options[option]["type"] type_ = provider_options[option]["type"]
print(f":param {type_} {option}: (optional) Notification option for ``type`` :attr:`~.NotificationType.{provider.name}`") print(f":param {type_}, optional {option}: Notification option for ``type`` :attr:`~.NotificationType.{provider.name}`")

View file

@ -189,7 +189,7 @@ def _build_maintenance_data(
) -> dict: ) -> dict:
if not dateRange: if not dateRange:
dateRange = [ dateRange = [
datetime.date.today().strftime("%Y-%m-%d 00:00") datetime.date.today().strftime("%Y-%m-%d 00:00:00")
] ]
if not timeRange: if not timeRange:
timeRange = [ timeRange = [
@ -338,6 +338,7 @@ def _check_arguments_maintenance(kwargs) -> None:
) )
_check_argument_conditions(conditions, kwargs) _check_argument_conditions(conditions, kwargs)
class UptimeKumaApi(object): class UptimeKumaApi(object):
"""This class is used to communicate with Uptime Kuma. """This class is used to communicate with Uptime Kuma.
@ -2157,7 +2158,7 @@ class UptimeKumaApi(object):
:param str, optional password: Password, defaults to None :param str, optional password: Password, defaults to None
:param bool, optional checkUpdate: Show update if available, defaults to True :param bool, optional checkUpdate: Show update if available, defaults to True
:param bool, optional checkBeta: Also check beta release, defaults to False :param bool, optional checkBeta: Also check beta release, defaults to False
:param int, optional keepDataPeriodDays: Keep monitor history data for X days., defaults to 180 :param int, optional keepDataPeriodDays: Keep monitor history data for X days. Set to 0 for infinite retention., defaults to 180
:param str, optional serverTimezone: Server Timezone, defaults to "" :param str, optional serverTimezone: Server Timezone, defaults to ""
:param str, optional entryPage: Entry Page, defaults to "dashboard" :param str, optional entryPage: Entry Page, defaults to "dashboard"
:param bool, optional searchEngineIndex: Search Engine Visibility, defaults to False :param bool, optional searchEngineIndex: Search Engine Visibility, defaults to False

View file

@ -120,9 +120,17 @@ def notification_docstring(mode) -> str:
:param str, optional pagerdutyIntegrationKey: Notification option for ``type`` :attr:`~.NotificationType.PAGERDUTY` :param str, optional pagerdutyIntegrationKey: Notification option for ``type`` :attr:`~.NotificationType.PAGERDUTY`
:param str, optional promosmsLogin: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS` :param str, optional promosmsLogin: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS`
:param str, optional promosmsPassword: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS` :param str, optional promosmsPassword: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS`
:param str, optional promosmsPhoneNumber: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS` :param str, optional promosmsPhoneNumber: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS`. Phone number (for Polish recipient You can skip area codes).
:param str, optional promosmsSMSType: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS` :param str, optional promosmsSMSType: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS`.
Available values are:
- ``0``: SMS FLASH - Message will automatically show on recipient device. Limited only to Polish recipients.
- ``1``: SMS ECO - cheap but slow and often overloaded. Limited only to Polish recipients.
- ``3``: SMS FULL - Premium tier of SMS, You can use your Sender Name (You need to register name first). Reliable for alerts.
- ``4``: SMS SPEED - Highest priority in system. Very quick and reliable but costly (about twice of SMS FULL price).
:param str, optional promosmsSenderName: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS` :param str, optional promosmsSenderName: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS`
:param bool, optional promosmsAllowLongSMS: Notification option for ``type`` :attr:`~.NotificationType.PROMOSMS`. Allow long SMS.
:param str, optional pushbulletAccessToken: Notification option for ``type`` :attr:`~.NotificationType.PUSHBULLET` :param str, optional pushbulletAccessToken: Notification option for ``type`` :attr:`~.NotificationType.PUSHBULLET`
:param str, optional pushdeerKey: Notification option for ``type`` :attr:`~.NotificationType.PUSHDEER` :param str, optional pushdeerKey: Notification option for ``type`` :attr:`~.NotificationType.PUSHDEER`
:param str, optional pushoveruserkey: Notification option for ``type`` :attr:`~.NotificationType.PUSHOVER` :param str, optional pushoveruserkey: Notification option for ``type`` :attr:`~.NotificationType.PUSHOVER`
@ -211,13 +219,34 @@ def notification_docstring(mode) -> str:
:param str, optional ntfyserverurl: Notification option for ``type`` :attr:`~.NotificationType.NTFY` :param str, optional ntfyserverurl: Notification option for ``type`` :attr:`~.NotificationType.NTFY`
:param bool, optional smseagleEncoding: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. True to send messages in unicode. :param bool, optional smseagleEncoding: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. True to send messages in unicode.
:param int, optional smseaglePriority: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Message priority (0-9, default = 0). :param int, optional smseaglePriority: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Message priority (0-9, default = 0).
:param str, optional smseagleRecipientType: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Recipient type. Available values are "smseagle-to" (Phone number(s)), "smseagle-group" (Phonebook group name(s)) and "smseagle-contact" (Phonebook contact name(s)). :param str, optional smseagleRecipientType: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Recipient type.
Available values are:
- ``smseagle-to``: Phone number(s)
- ``smseagle-group``: Phonebook group name(s)
- ``smseagle-contact``: Phonebook contact name(s)
:param str, optional smseagleToken: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. API Access token. :param str, optional smseagleToken: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. API Access token.
:param str, optional smseagleRecipient: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Recipient(s) (multiple must be separated with comma). :param str, optional smseagleRecipient: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Recipient(s) (multiple must be separated with comma).
:param str, optional smseagleUrl: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Your SMSEagle device URL. :param str, optional smseagleUrl: Notification option for ``type`` :attr:`~.NotificationType.SMSEAGLE`. Your SMSEagle device URL.
:param str, optional webhookUrl: Notification option for ``type`` :attr:`~.NotificationType.ZOHOCLIQ` :param str, optional webhookUrl: Notification option for ``type`` :attr:`~.NotificationType.ZOHOCLIQ`
:param str, optional kookGuildID: Notification option for ``type`` :attr:`~.NotificationType.KOOK` :param str, optional kookGuildID: Notification option for ``type`` :attr:`~.NotificationType.KOOK`
:param str, optional kookBotToken: Notification option for ``type`` :attr:`~.NotificationType.KOOK` :param str, optional kookBotToken: Notification option for ``type`` :attr:`~.NotificationType.KOOK`
:param str, optional splunkAutoResolve: Notification option for ``type`` :attr:`~.NotificationType.SPLUNK`. Auto resolve or acknowledged.
Available values are:
- ``0``: do nothing
- ``ACKNOWLEDGEMENT``: auto acknowledged
- ``RECOVERY``: auto resolve
:param str, optional splunkSeverity: Notification option for ``type`` :attr:`~.NotificationType.SPLUNK`. Severity.
Available values are:
- ``INFO``
- ``WARNING``
- ``CRITICAL``
:param str, optional splunkRestURL: Notification option for ``type`` :attr:`~.NotificationType.SPLUNK`. Splunk Rest URL.
""" """

View file

@ -142,6 +142,9 @@ class NotificationType(str, Enum):
KOOK = "Kook" KOOK = "Kook"
"""Kook""" """Kook"""
SPLUNK = "Splunk"
"""Splunk"""
notification_provider_options = { notification_provider_options = {
NotificationType.ALERTA: dict( NotificationType.ALERTA: dict(
@ -236,6 +239,7 @@ notification_provider_options = {
promosmsPhoneNumber=dict(type="str"), promosmsPhoneNumber=dict(type="str"),
promosmsSMSType=dict(type="str"), promosmsSMSType=dict(type="str"),
promosmsSenderName=dict(type="str"), promosmsSenderName=dict(type="str"),
promosmsAllowLongSMS=dict(type="bool"),
), ),
NotificationType.PUSHBULLET: dict( NotificationType.PUSHBULLET: dict(
pushbulletAccessToken=dict(type="str"), pushbulletAccessToken=dict(type="str"),
@ -390,6 +394,11 @@ notification_provider_options = {
kookGuildID=dict(type="str"), kookGuildID=dict(type="str"),
kookBotToken=dict(type="str") kookBotToken=dict(type="str")
), ),
NotificationType.SPLUNK: dict(
splunkAutoResolve=dict(type="str"),
splunkSeverity=dict(type="str"),
splunkRestURL=dict(type="str")
)
} }
notification_provider_conditions = dict( notification_provider_conditions = dict(