From: Marcin Haba Date: Tue, 28 Feb 2023 09:52:00 +0000 (+0100) Subject: baculum: Add objectid parameter to Bvfs restore endpoint X-Git-Tag: Release-13.0.3~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c212e1d673e4918d788b869feb4fff31bbbc551;p=thirdparty%2Fbacula.git baculum: Add objectid parameter to Bvfs restore endpoint --- diff --git a/gui/baculum/protected/API/Pages/API/BVFSRestore.php b/gui/baculum/protected/API/Pages/API/BVFSRestore.php index ec24046ca..93c6db349 100644 --- a/gui/baculum/protected/API/Pages/API/BVFSRestore.php +++ b/gui/baculum/protected/API/Pages/API/BVFSRestore.php @@ -38,6 +38,7 @@ class BVFSRestore extends BaculumAPIServer { $fileids = property_exists($params, 'fileid') ? $params->fileid : null; $dirids = property_exists($params, 'dirid') ? $params->dirid : null; $findexes = property_exists($params, 'findex') ? $params->findex : null; + $objectids = property_exists($params, 'objectid') ? $params->objectid : null; $path = property_exists($params, 'path') ? $params->path : null; if (!is_null($jobids) && !$misc->isValidIdsList($jobids)) { @@ -60,6 +61,11 @@ class BVFSRestore extends BaculumAPIServer { $this->error = BVFSError::ERROR_INVALID_FILEINDEX_LIST; return; } + if (!is_null($objectids) && !$misc->isValidIdsList($objectids)) { + $this->output = BVFSError::MSG_ERROR_INVALID_OBJECTID_LIST; + $this->error = BVFSError::ERROR_INVALID_OBJECTID_LIST; + return; + } if (!is_null($path) && !$misc->isValidBvfsPath($path)) { $this->output = BVFSError::MSG_ERROR_INVALID_RPATH; @@ -77,6 +83,9 @@ class BVFSRestore extends BaculumAPIServer { if (is_string($findexes)) { array_push($cmd, 'hardlink="' . $findexes . '"'); } + if (is_string($objectids)) { + array_push($cmd, 'objectid="' . $objectids . '"'); + } $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd); $this->output = $result->output; diff --git a/gui/baculum/protected/API/openapi_baculum.json b/gui/baculum/protected/API/openapi_baculum.json index 2fe931dc8..7c25719fb 100644 --- a/gui/baculum/protected/API/openapi_baculum.json +++ b/gui/baculum/protected/API/openapi_baculum.json @@ -5285,7 +5285,7 @@ "error": { "type": "integer", "description": "Error code", - "enum": [0, 1, 2, 3, 4, 5, 6, 7, 11, 71, 73, 74, 75, 76, 1000] + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 11, 71, 73, 74, 75, 76, 79, 1000] } } } @@ -5338,6 +5338,15 @@ "schema": { "type": "string" } + }, + { + "name": "objectid", + "in": "body", + "description": "Comma seprated object identifiers", + "required": false, + "schema": { + "type": "string" + } } ] } diff --git a/gui/baculum/protected/Common/Modules/Errors/BVFSError.php b/gui/baculum/protected/Common/Modules/Errors/BVFSError.php index 3969ed8c0..ac0a40633 100644 --- a/gui/baculum/protected/Common/Modules/Errors/BVFSError.php +++ b/gui/baculum/protected/Common/Modules/Errors/BVFSError.php @@ -38,6 +38,7 @@ class BVFSError extends GenericError { const ERROR_INVALID_DIRID_LIST = 76; const ERROR_INVALID_CLIENT = 77; const ERROR_INVALID_JOBID = 78; + const ERROR_INVALID_OBJECTID_LIST = 79; const MSG_ERROR_INVALID_RPATH = 'Inputted path for restore is invalid. Proper format is b2[0-9]+.'; const MSG_ERROR_INVALID_RESTORE_PATH = 'Inputted BVFS path param is invalid.'; @@ -47,4 +48,5 @@ class BVFSError extends GenericError { const MSG_ERROR_INVALID_DIRID_LIST = 'Invalid dirid list.'; const MSG_ERROR_INVALID_CLIENT = 'Invalid client name.'; const MSG_ERROR_INVALID_JOBID = 'Invalid jobid.'; + const MSG_ERROR_INVALID_OBJECTID_LIST = 'Invalid objectid list.'; }