From: Marcin Haba Date: Fri, 15 Sep 2023 08:22:55 +0000 (+0200) Subject: baculum: Add delete pool endpoint X-Git-Tag: Beta-15.0.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab20e2dfdc7c03f544f6b8a98506977fe90beb01;p=thirdparty%2Fbacula.git baculum: Add delete pool endpoint --- 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; + } + } } ?>