]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add restore_host parameter to vsphere plugin datastores API endpoint
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 13 Mar 2023 10:12:42 +0000 (11:12 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Thu, 20 Apr 2023 10:00:25 +0000 (12:00 +0200)
gui/baculum/protected/API/Pages/API/PluginVSphereListDatastores.php
gui/baculum/protected/API/openapi_baculum.json

index 62ffb483bb0a236fb6a20af90354dcbebf7f8a4c..9c0fd505adbf5af099ed76e5e7c8bd56f45ec7e3 100644 (file)
@@ -60,12 +60,17 @@ class PluginVSphereListDatastores extends ConsoleOutputQueryPage {
                        return;
                }
 
+               $misc = $this->getModule('misc');
                $out_format = ConsoleOutputPage::OUTPUT_FORMAT_RAW;
                if ($this->Request->contains('output') && $this->isOutputFormatValid($this->Request['output'])) {
                        $out_format = $this->Request['output'];
                }
+               $restore_host = $this->Request->contains('restore_host') && $misc->isValidName($this->Request['restore_host'])? $this->Request['restore_host'] : '';
 
-               $plugin = 'vsphere: ';
+               $plugin = 'vsphere:';
+               if (!empty($restore_host)) {
+                       $plugin .= ' restore_host="' . $restore_host . '"';
+               }
                $out = new \StdClass;
                $out->output = [];
                $params = ['client' => $client, 'plugin' => $plugin];
index e1c3685c37814e750921aed75b3ee8b3df0ff10e..5ceb4e003ba3c2e9c5bac63900822f341239bbb7 100644 (file)
                                        },
                                        {
                                                "$ref": "#/components/parameters/Output"
+                                       },
+                                       {
+                                               "name": "restore_host",
+                                               "in": "query",
+                                               "required": false,
+                                               "description": "VMware restore host",
+                                               "schema": {
+                                                       "type": "string"
+                                               }
                                        }
                                ]
                        }