mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Implements RESTful delete of interface pools and members
Implements #4108
This commit is contained in:
parent
519fec5f94
commit
62c35e82ec
6 changed files with 33 additions and 1 deletions
|
|
@ -4,20 +4,45 @@
|
|||
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/pools/?.lua;" .. package.path
|
||||
|
||||
require "lua_utils"
|
||||
local json = require "dkjson"
|
||||
local rest_utils = require "rest_utils"
|
||||
local interface_pools = require "interface_pools"
|
||||
|
||||
--
|
||||
-- Delete an existing pool
|
||||
--
|
||||
|
||||
local pool_id = _GET["pool"]
|
||||
|
||||
sendHTTPHeader('application/json')
|
||||
|
||||
if not isAdministrator() then
|
||||
print(rest_utils.rc(rest_utils.consts_not_granted))
|
||||
return
|
||||
end
|
||||
|
||||
if not pool_id then
|
||||
print(rest_utils.rc(rest_utils.consts_invalid_args))
|
||||
return
|
||||
end
|
||||
|
||||
-- pool_id as number
|
||||
pool_id = tonumber(pool_id)
|
||||
|
||||
local s = interface_pools:create()
|
||||
local res = s:delete_pool(pool_id)
|
||||
|
||||
if not res then
|
||||
print(rest_utils.rc(rest_utils.consts_delete_pool_failed))
|
||||
return
|
||||
end
|
||||
|
||||
local rc = rest_utils.consts_ok
|
||||
local res = {
|
||||
-- STUB
|
||||
pool_id = new_pool_id
|
||||
}
|
||||
|
||||
print(rest_utils.rc(rc, res))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue