From ab20e2dfdc7c03f544f6b8a98506977fe90beb01 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Fri, 15 Sep 2023 10:22:55 +0200 Subject: [PATCH] baculum: Add delete pool endpoint --- gui/baculum/protected/API/Pages/API/Pool.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gui/baculum/protected/API/Pages/API/Pool.php b/gui/baculum/protected/API/Pages/API/Pool.php index b8363ddd2..017c62543 100644 --- a/gui/baculum/protected/API/Pages/API/Pool.php +++ b/gui/baculum/protected/API/Pages/API/Pool.php @@ -20,6 +20,7 @@ * Bacula(R) is a registered trademark of Kern Sibbald. */ +use Baculum\API\Modules\Delete; use Baculum\API\Modules\BaculumAPIServer; use Baculum\Common\Modules\Errors\PoolError; @@ -53,5 +54,22 @@ class Pool extends BaculumAPIServer { $this->error = $result->exitcode; } } + + public function remove($id) { + $poolid = (int)$id; + $pool = $this->getModule('pool')->getPoolById($poolid); + if (is_object($pool)) { + $result = $this->getModule('delete')->delete( + $this->director, + Delete::TYPE_POOL, + $pool->name + ); + $this->output = $result['output']; + $this->error = $result['error']; + } else { + $this->output = PoolError::MSG_ERROR_POOL_DOES_NOT_EXISTS; + $this->error = PoolError::ERROR_POOL_DOES_NOT_EXISTS; + } + } } ?> -- 2.47.3