mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Implements REST API endpoint to get pools for any available type
Implements #4263
This commit is contained in:
parent
bf7a5c2776
commit
6e0ae904df
6 changed files with 65 additions and 5 deletions
|
|
@ -20,12 +20,13 @@ local pools_lua_utils = {}
|
|||
--
|
||||
-- This method is useful to perform operations (such as the deletion of a configset id) which are
|
||||
-- global and affect all the pool instances. Indeed a configset id is shared across all pools
|
||||
local function all_pool_instances_factory()
|
||||
function pools_lua_utils.all_pool_instances_factory()
|
||||
local pools_dir = os_utils.fixPath(dirs.installdir .. "/scripts/lua/modules/pools/")
|
||||
local res = {}
|
||||
|
||||
for pool_file in pairs(ntop.readdir(pools_dir)) do
|
||||
if pool_file:match("%.lua$") then
|
||||
-- Load all sub-classes of base_pools.lua (and exclude base_pools.lua itself)
|
||||
if pool_file:match("_pools%.lua$") and not pool_file:match("^base_pools.lua$") then
|
||||
local pool_file_path = os_utils.fixPath(string.format("%s/%s", pools_dir, pool_file))
|
||||
|
||||
local pool = dofile(pool_file_path)
|
||||
|
|
@ -48,7 +49,7 @@ end
|
|||
|
||||
-- @brief Call `instance:unbind_all_configset_id` for every available pools `instance`
|
||||
function pools_lua_utils.unbind_all_configset_id(configset_id)
|
||||
local all_instances = all_pool_instances_factory()
|
||||
local all_instances = pools_lua_utils.all_pool_instances_factory()
|
||||
|
||||
for _, instance in pairs(all_instances) do
|
||||
instance:unbind_all_configset_id(configset_id)
|
||||
|
|
@ -59,7 +60,7 @@ end
|
|||
|
||||
-- @brief Call `instance:unbind_all_configset_id` for every available pools `instance`
|
||||
function pools_lua_utils.unbind_all_recipient_id(recipient_id)
|
||||
local all_instances = all_pool_instances_factory()
|
||||
local all_instances = pools_lua_utils.all_pool_instances_factory()
|
||||
|
||||
for _, instance in pairs(all_instances) do
|
||||
instance:unbind_all_recipient_id(recipient_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue