From: Marcin Haba Date: Mon, 24 Apr 2023 09:15:27 +0000 (+0200) Subject: baculum: Add pool filter to volumes endpoint X-Git-Tag: Release-13.0.3~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aac9597143535bdf9f5218d658591b83e716dfb3;p=thirdparty%2Fbacula.git baculum: Add pool filter to volumes endpoint --- diff --git a/gui/baculum/protected/API/Modules/VolumeManager.php b/gui/baculum/protected/API/Modules/VolumeManager.php index 223478910..738bc6947 100644 --- a/gui/baculum/protected/API/Modules/VolumeManager.php +++ b/gui/baculum/protected/API/Modules/VolumeManager.php @@ -138,6 +138,11 @@ class VolumeManager extends APIModule { ]; } } + if (key_exists('pool', $props)) { + $criteria['pool1.Name'][] = [ + 'vals' => $props['pool'] + ]; + } $limit = ''; if(is_int($limit_val) && $limit_val > 0) { diff --git a/gui/baculum/protected/API/Pages/API/Volumes.php b/gui/baculum/protected/API/Pages/API/Volumes.php index 3286e50c5..eca2792c8 100644 --- a/gui/baculum/protected/API/Pages/API/Volumes.php +++ b/gui/baculum/protected/API/Pages/API/Volumes.php @@ -41,6 +41,7 @@ class Volumes extends BaculumAPIServer { $enabled = $misc->isValidBooleanTrue($this->Request['enabled']) ? 1 : 0; } $voltype = $this->Request->contains('voltype') && $misc->isValidVolType($this->Request['voltype']) ? $this->Request['voltype'] : null; + $pool = $this->Request->contains('pool') && $misc->isValidName($this->Request['pool']) ? $this->Request['pool'] : null; $params = $props = []; @@ -60,6 +61,10 @@ class Volumes extends BaculumAPIServer { $props['voltype'] = $voltype; } + if (is_string($pool)) { + $props['pool'] = $pool; + } + $result = $this->getModule('volume')->getVolumes( $params, $props, diff --git a/gui/baculum/protected/API/openapi_baculum.json b/gui/baculum/protected/API/openapi_baculum.json index f00723cc5..364925441 100644 --- a/gui/baculum/protected/API/openapi_baculum.json +++ b/gui/baculum/protected/API/openapi_baculum.json @@ -4062,6 +4062,15 @@ "type": "string" } }, + { + "name": "pool", + "in": "query", + "description": "Volume pool name.", + "required": false, + "schema": { + "type": "string" + } + }, { "name": "enabled", "in": "query",