lemur/lemur/plugins/bases/notification.py

55 lines
1.5 KiB
Python
Raw Normal View History

"""
.. module: lemur.plugins.bases.notification
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from lemur.plugins.base import Plugin
class NotificationPlugin(Plugin):
"""
This is the base class from which all of the supported
issuers will inherit from.
"""
2019-05-16 16:57:02 +02:00
type = "notification"
2016-12-08 20:33:40 +01:00
def send(self, notification_type, message, targets, options, **kwargs):
raise NotImplementedError
class ExpirationNotificationPlugin(NotificationPlugin):
"""
This is the base class for all expiration notification plugins.
It contains some default options that are needed for all expiration
notification plugins.
"""
2019-05-16 16:57:02 +02:00
default_options = [
{
2019-05-16 16:57:02 +02:00
"name": "interval",
"type": "int",
"required": True,
"validation": "^\d+$",
"helpMessage": "Number of days to be alert before expiration.",
},
{
2019-05-16 16:57:02 +02:00
"name": "unit",
"type": "select",
"required": True,
"validation": "",
"available": ["days", "weeks", "months"],
"helpMessage": "Interval unit",
},
]
@property
def options(self):
return self.default_options + self.additional_options
2016-12-08 20:33:40 +01:00
def send(self, notification_type, message, targets, options, **kwargs):
raise NotImplementedError