From 2773d02ee689f259dce8e1613d413c2e1c9022c3 Mon Sep 17 00:00:00 2001 From: lucasheld Date: Thu, 30 Mar 2023 11:47:47 +0200 Subject: [PATCH] feat: add support for uptime kuma 1.21.1 --- README.md | 2 +- run_tests.sh | 2 +- uptime_kuma_api/docstrings.py | 14 ++++++++++++-- uptime_kuma_api/notification_providers.py | 21 +++++++++++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ad7f6ca..0cee7af 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This package was developed to configure Uptime Kuma with Ansible. The Ansible co Python version 3.6+ is required. -Supported Uptime Kuma versions: 1.17.0 - 1.21.0 +Supported Uptime Kuma versions: 1.17.0 - 1.21.1 Installation --- diff --git a/run_tests.sh b/run_tests.sh index 66753ae..2a573bb 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -5,7 +5,7 @@ if [ $version ] then versions=("$version") else - versions=(1.21.0 1.20.2 1.19.6 1.18.5 1.17.1) + versions=(1.21.1 1.20.2 1.19.6 1.18.5 1.17.1) fi for version in ${versions[*]} diff --git a/uptime_kuma_api/docstrings.py b/uptime_kuma_api/docstrings.py index b885281..8d4d1bf 100644 --- a/uptime_kuma_api/docstrings.py +++ b/uptime_kuma_api/docstrings.py @@ -109,8 +109,8 @@ def notification_docstring(mode) -> str: :param str, optional lineChannelAccessToken: Notification option for ``type`` :attr:`~.NotificationType.LINE` :param str, optional lineUserID: Notification option for ``type`` :attr:`~.NotificationType.LINE` :param str, optional lunaseaTarget: Notification option for ``type`` :attr:`~.NotificationType.LUNASEA`. Allowed values: "device", "user". - :param str, optional lunaseaUserID: Notification option for ``type`` :attr:`~.NotificationType.LUNASEA` - :param str, optional lunaseaDevice: Notification option for ``type`` :attr:`~.NotificationType.LUNASEA` + :param str, optional lunaseaUserID: Notification option for ``type`` :attr:`~.NotificationType.LUNASEA`. User ID. + :param str, optional lunaseaDevice: Notification option for ``type`` :attr:`~.NotificationType.LUNASEA`. Device ID. :param str, optional internalRoomId: Notification option for ``type`` :attr:`~.NotificationType.MATRIX` :param str, optional accessToken: Notification option for ``type`` :attr:`~.NotificationType.MATRIX` :param str, optional homeserverUrl: Notification option for ``type`` :attr:`~.NotificationType.MATRIX` @@ -275,6 +275,16 @@ def notification_docstring(mode) -> str: - ``WARNING`` - ``CRITICAL`` :param str, optional splunkRestURL: Notification option for ``type`` :attr:`~.NotificationType.SPLUNK`. Splunk Rest URL. + :param int, optional opsgeniePriority: Notification option for ``type`` :attr:`~.NotificationType.OPSGENIE`. Priority. Available values are numbers between ``1`` and ``5``. + :param str, optional opsgenieRegion: Notification option for ``type`` :attr:`~.NotificationType.OPSGENIE`. Region. Available values are: + + - ``us``: US (Default) + - ``eu``: EU + :param str, optional opsgenieApiKey: Notification option for ``type`` :attr:`~.NotificationType.OPSGENIE`. API Key. + :param str, optional twilioAccountSID: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. Account SID. + :param str, optional twilioAuthToken: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. Auth Token. + :param str, optional twilioToNumber: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. To Number. + :param str, optional twilioFromNumber: Notification option for ``type`` :attr:`~.NotificationType.TWILIO`. From Number. """ diff --git a/uptime_kuma_api/notification_providers.py b/uptime_kuma_api/notification_providers.py index 5c7b3a6..ab23fb9 100644 --- a/uptime_kuma_api/notification_providers.py +++ b/uptime_kuma_api/notification_providers.py @@ -148,6 +148,12 @@ class NotificationType(str, Enum): SPLUNK = "Splunk" """Splunk""" + OPSGENIE = "Opsgenie" + """Opsgenie""" + + TWILIO = "twilio" + """twilio""" + notification_provider_options = { NotificationType.ALERTA: dict( @@ -411,6 +417,17 @@ notification_provider_options = { splunkAutoResolve=dict(type="str"), splunkSeverity=dict(type="str"), splunkRestURL=dict(type="str") + ), + NotificationType.OPSGENIE: dict( + opsgeniePriority=dict(type="int"), + opsgenieRegion=dict(type="str"), + opsgenieApiKey=dict(type="str") + ), + NotificationType.TWILIO: dict( + twilioAccountSID=dict(type="str"), + twilioAuthToken=dict(type="str"), + twilioToNumber=dict(type="str"), + twilioFromNumber=dict(type="str") ) } @@ -430,5 +447,9 @@ notification_provider_conditions = dict( smseaglePriority=dict( min=0, max=9 + ), + opsgeniePriority=dict( + min=1, + max=5 ) )