]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add delete pool endpoint
authorMarcin Haba <marcin.haba@bacula.pl>
Fri, 15 Sep 2023 08:22:55 +0000 (10:22 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 31 Oct 2023 15:00:30 +0000 (16:00 +0100)
gui/baculum/protected/API/Pages/API/Pool.php

index b8363ddd2c39113e8fc2354bb52c5dd7aaaf8c07..017c625437d0e083fc366d68301e2b4f7202fb08 100644 (file)
@@ -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;
+               }
+       }
 }
 ?>