]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add pool filter to volumes endpoint
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 24 Apr 2023 09:15:27 +0000 (11:15 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Mon, 1 May 2023 11:18:25 +0000 (13:18 +0200)
gui/baculum/protected/API/Modules/VolumeManager.php
gui/baculum/protected/API/Pages/API/Volumes.php
gui/baculum/protected/API/openapi_baculum.json

index 223478910c1511c8e6cdc3d8b3afaed560f7550d..738bc6947e8d460bf5fa03a06a77822dc46c5d52 100644 (file)
@@ -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) {
index 3286e50c5afe3eb5e553396b93e31a672ff4c856..eca2792c841f54466a8fe0b948936b1ca2e3eb31 100644 (file)
@@ -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,
index f00723cc50467e47424f205f20c4db560726aab5..364925441ffb884bcbd63f5a65ca2ae2c1088840 100644 (file)
                                                        "type": "string"
                                                }
                                        },
+                                       {
+                                               "name": "pool",
+                                               "in": "query",
+                                               "description": "Volume pool name.",
+                                               "required": false,
+                                               "schema": {
+                                                       "type": "string"
+                                               }
+                                       },
                                        {
                                                "name": "enabled",
                                                "in": "query",