mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
79 lines
2.2 KiB
Lua
79 lines
2.2 KiB
Lua
--
|
|
-- (C) 2017-20 - ntop.org
|
|
--
|
|
|
|
require "lua_utils"
|
|
local json = require "dkjson"
|
|
|
|
-- ##############################################
|
|
|
|
local base_recipients = {}
|
|
|
|
-- ##############################################
|
|
|
|
function base_recipients:create(args)
|
|
if args then
|
|
-- We're being sub-classed
|
|
if not args.key then
|
|
return nil
|
|
end
|
|
end
|
|
|
|
local this = args or {key = "base"}
|
|
|
|
setmetatable(this, self)
|
|
self.__index = self
|
|
|
|
if args then
|
|
-- Initialization is only run if a subclass is being instanced, that is,
|
|
-- when args is not nil
|
|
this:_initialize()
|
|
end
|
|
|
|
return this
|
|
end
|
|
|
|
-- ##############################################
|
|
|
|
-- @brief Performs initialization operations at the time when the instance is created
|
|
function base_recipients:_initialize()
|
|
-- Possibly create a default recipient (if not existing)
|
|
end
|
|
|
|
-- ##############################################
|
|
|
|
-- @brief Dispatches a store `notification` to the recipient
|
|
-- @param notification A JSON string with all the alert information
|
|
-- @return true If the dispatching has been successfull, false otherwise
|
|
function base_recipients:dispatch_store_notification(notification)
|
|
return true
|
|
end
|
|
|
|
-- ##############################################
|
|
|
|
-- @brief Dispatches a trigger `notification` to the recipient
|
|
-- @param notification A JSON string with all the alert information
|
|
-- @return true If the dispatching has been successfull, false otherwise
|
|
function base_recipients:dispatch_trigger_notification(notification)
|
|
return true
|
|
end
|
|
|
|
-- ##############################################
|
|
|
|
-- @brief Dispatches a release `notification` to the recipient
|
|
-- @param notification A JSON string with all the alert information
|
|
-- @return true If the dispatching has been successfull, false otherwise
|
|
function base_recipients:dispatch_release_notification(notification)
|
|
return true
|
|
end
|
|
|
|
-- ##############################################
|
|
|
|
-- @brief Process notifications previously dispatched with one of the dispatch_{store,trigger,release}_notification
|
|
function base_recipients:process_notifications()
|
|
return true
|
|
end
|
|
|
|
-- ##############################################
|
|
|
|
return base_recipients
|