mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Started fixing rest Documentation and postman collection creation (#8987)
This commit is contained in:
parent
4c611cf661
commit
fe18eff11d
23 changed files with 147 additions and 44 deletions
37
scripts/lua/rest/v2/get/checks/subdirs.lua
Normal file
37
scripts/lua/rest/v2/get/checks/subdirs.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
--
|
||||
-- (C) 2019-25 - ntop.org
|
||||
--
|
||||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
|
||||
require "lua_utils"
|
||||
local json = require("dkjson")
|
||||
local checks = require("checks")
|
||||
local rest_utils = require "rest_utils"
|
||||
local auth = require "auth"
|
||||
|
||||
|
||||
-- Return all checks subdirs supported by ntopng for checks
|
||||
-- Example: curl -u admin:admin -H "Content-Type: application/json" http://localhost:3000/lua/rest/v2/get/checks/subdirs.lua
|
||||
--
|
||||
|
||||
local rc = rest_utils.consts.success.ok
|
||||
|
||||
if not auth.has_capability(auth.capabilities.checks) then
|
||||
rest_utils.answer(rest_utils.consts.err.not_granted)
|
||||
return
|
||||
end
|
||||
|
||||
local subdirs = {}
|
||||
|
||||
for _, subdir in pairs(checks.listSubdirs()) do
|
||||
subdirs[#subdirs + 1] = subdir.id
|
||||
end
|
||||
|
||||
local subdirs_list = {
|
||||
checks_subdirs = subdirs
|
||||
}
|
||||
|
||||
rest_utils.answer(rc, subdirs_list)
|
||||
Loading…
Add table
Add a link
Reference in a new issue