From d484aafc69ff658a6fd306784c1bf9372e2ff51d Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Fri, 21 Jun 2024 16:31:51 +0200 Subject: [PATCH] baculum: Add enable and disable client, storage, job and schedule endpoints --- .../protected/API/Modules/Bconsole.php | 4 +- .../protected/API/Modules/DisableResource.php | 88 ++++++ .../protected/API/Modules/EnableResource.php | 88 ++++++ .../protected/API/Pages/API/DisableClient.php | 79 +++++ .../protected/API/Pages/API/DisableJob.php | 79 +++++ .../API/Pages/API/DisableSchedule.php | 75 +++++ .../API/Pages/API/DisableStorage.php | 82 +++++ .../protected/API/Pages/API/EnableClient.php | 79 +++++ .../protected/API/Pages/API/EnableJob.php | 79 +++++ .../API/Pages/API/EnableSchedule.php | 75 +++++ .../protected/API/Pages/API/EnableStorage.php | 82 +++++ .../protected/API/Pages/API/config.xml | 2 + .../protected/API/Pages/API/endpoints.xml | 8 + .../protected/API/openapi_baculum.json | 286 ++++++++++++++++++ 14 files changed, 1105 insertions(+), 1 deletion(-) create mode 100644 gui/baculum/protected/API/Modules/DisableResource.php create mode 100644 gui/baculum/protected/API/Modules/EnableResource.php create mode 100644 gui/baculum/protected/API/Pages/API/DisableClient.php create mode 100644 gui/baculum/protected/API/Pages/API/DisableJob.php create mode 100644 gui/baculum/protected/API/Pages/API/DisableSchedule.php create mode 100644 gui/baculum/protected/API/Pages/API/DisableStorage.php create mode 100644 gui/baculum/protected/API/Pages/API/EnableClient.php create mode 100644 gui/baculum/protected/API/Pages/API/EnableJob.php create mode 100644 gui/baculum/protected/API/Pages/API/EnableSchedule.php create mode 100644 gui/baculum/protected/API/Pages/API/EnableStorage.php diff --git a/gui/baculum/protected/API/Modules/Bconsole.php b/gui/baculum/protected/API/Modules/Bconsole.php index 0f32e0400..203eb4f01 100644 --- a/gui/baculum/protected/API/Modules/Bconsole.php +++ b/gui/baculum/protected/API/Modules/Bconsole.php @@ -103,7 +103,9 @@ class Bconsole extends APIModule { '.search', '@putfile', 'cloud', - 'time' + 'time', + 'disable', + 'enable' ); private $config; diff --git a/gui/baculum/protected/API/Modules/DisableResource.php b/gui/baculum/protected/API/Modules/DisableResource.php new file mode 100644 index 000000000..74a7b4240 --- /dev/null +++ b/gui/baculum/protected/API/Modules/DisableResource.php @@ -0,0 +1,88 @@ + + * @category Module + * @package Baculum API + */ +class DisableResource extends APIModule { + + /** + * Resources allowed to disable. + * This resources support disabling/enabling. + */ + const ALLOWED_RESOURCES = [ + 'dir' => [ + 'Client', + 'Storage', + 'Job', + 'Schedule' + ], + 'sd' => [ + 'Storage' + ], + 'fd' => [ + 'FileDaemon' + ] + ]; + + public function isResourceSupported($component_type, $resource_type) { + return isset(self::ALLOWED_RESOURCES[$component_type][$resource_type]); + } + + /** + * Disable resource. + * + * @param string $director Director name + * @param string $component_type component type + * @param string $resource_type resource type + * @param string $resource_name resource name + * @param array $params extra parameters + * @return object result and exitcode + */ + public function disable($director, $component_type, $resource_type, $resource_name, $params = []) { + $ret = (object) ['output' => '','exitcode' => -1]; + if ($this->isResourceSupported($component_type, $resource_type)) { + $ret->output = 'Resource not supported'; + return $ret; + } + + $key = strtolower($resource_type); + $value = $resource_name; + $cmd = ['disable', "$key=\"$value\""]; + if (count($params) > 0) { + $cmd = array_merge($cmd, $params); + } + $ret = $this->getModule('bconsole')->bconsoleCommand( + $director, + $cmd + ); + return $ret; + } +} diff --git a/gui/baculum/protected/API/Modules/EnableResource.php b/gui/baculum/protected/API/Modules/EnableResource.php new file mode 100644 index 000000000..e01fb3934 --- /dev/null +++ b/gui/baculum/protected/API/Modules/EnableResource.php @@ -0,0 +1,88 @@ + + * @category Module + * @package Baculum API + */ +class EnableResource extends APIModule { + + /** + * Resources allowed to enable. + * These resources support disabling/enabling. + */ + const ALLOWED_RESOURCES = [ + 'dir' => [ + 'Client', + 'Storage', + 'Job', + 'Schedule' + ], + 'sd' => [ + 'Storage' + ], + 'fd' => [ + 'FileDaemon' + ] + ]; + + public function isResourceSupported($component_type, $resource_type) { + return isset(self::ALLOWED_RESOURCES[$component_type][$resource_type]); + } + + /** + * Enable resource. + * + * @param string $director Director name + * @param string $component_type component type + * @param string $resource_type resource type + * @param string $resource_name resource name + * @param array $params extra parameters + * @return bool|object result and exitcode + */ + public function enable($director, $component_type, $resource_type, $resource_name, $params = []) { + $ret = (object) ['output' => '','exitcode' => -1]; + if ($this->isResourceSupported($component_type, $resource_type)) { + $ret->output = 'Resource not supported'; + return $ret; + } + + $key = strtolower($resource_type); + $value = $resource_name; + $cmd = ['enable', "$key=\"$value\""]; + if (count($params) > 0) { + $cmd = array_merge($cmd, $params); + } + $ret = $this->getModule('bconsole')->bconsoleCommand( + $director, + $cmd + ); + return $ret; + } +} diff --git a/gui/baculum/protected/API/Pages/API/DisableClient.php b/gui/baculum/protected/API/Pages/API/DisableClient.php new file mode 100644 index 000000000..807bd228e --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/DisableClient.php @@ -0,0 +1,79 @@ + + * @category API + * @package Baculum API + */ +class DisableClient extends BaculumAPIServer { + + public function set($id, $params) { + $clientid = (int) $id; + $client_mod = $this->getModule('client'); + $client = null; + if ($clientid > 0) { + $client = $client_mod->getClientById($clientid); + } + + $result = $this->getModule('bconsole')->bconsoleCommand( + $this->director, + ['.client'], + null, + true + ); + if ($result->exitcode === 0) { + if (is_object($client) && in_array($client->name, $result->output)) { + $component_type = 'dir'; + $resource_type = 'client'; + $resource_name = $client->name; + + $result = $this->getModule('disable')->disable( + $this->director, + $component_type, + $resource_type, + $resource_name + ); + $output = $result->output; + $error = $result->exitcode; + if ($error != 0) { + $output = ClientError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $error = ClientError::ERROR_WRONG_EXITCODE; + } + $this->output = $output; + $this->error = $error; + } else { + $this->output = ClientError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS; + $this->error = ClientError::ERROR_CLIENT_DOES_NOT_EXISTS; + } + } else { + $this->output = ClientError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $this->error = ClientError::ERROR_WRONG_EXITCODE; + } + } +} +?> diff --git a/gui/baculum/protected/API/Pages/API/DisableJob.php b/gui/baculum/protected/API/Pages/API/DisableJob.php new file mode 100644 index 000000000..9829e362d --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/DisableJob.php @@ -0,0 +1,79 @@ + + * @category API + * @package Baculum API + */ +class DisableJob extends BaculumAPIServer { + + public function set($id, $params) { + $jobid = (int) $id; + $job_mod = $this->getModule('job'); + $job = null; + if ($jobid > 0) { + $job = $job_mod->getJobById($jobid); + } + + $result = $this->getModule('bconsole')->bconsoleCommand( + $this->director, + ['.jobs'], + null, + true + ); + if ($result->exitcode === 0) { + if (is_object($job) && in_array($job->name, $result->output)) { + $component_type = 'dir'; + $resource_type = 'job'; + $resource_name = $job->name; + + $result = $this->getModule('disable')->disable( + $this->director, + $component_type, + $resource_type, + $resource_name + ); + $output = $result->output; + $error = $result->exitcode; + if ($error != 0) { + $output = JobError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $error = JobError::ERROR_WRONG_EXITCODE; + } + $this->output = $output; + $this->error = $error; + } else { + $this->output = JobError::MSG_ERROR_JOB_DOES_NOT_EXISTS; + $this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS; + } + } else { + $this->output = JobError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $this->error = JobError::ERROR_WRONG_EXITCODE; + } + } +} +?> diff --git a/gui/baculum/protected/API/Pages/API/DisableSchedule.php b/gui/baculum/protected/API/Pages/API/DisableSchedule.php new file mode 100644 index 000000000..8ff35bd2b --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/DisableSchedule.php @@ -0,0 +1,75 @@ + + * @category API + * @package Baculum API + */ +class DisableSchedule extends BaculumAPIServer { + + public function set($id, $params) { + $misc = $this->getModule('misc'); + $schedule_name = $this->Request->contains('name') && $misc->isValidName($this->Request['name']) ? $this->Request['name'] : ''; + + $result = $this->getModule('bconsole')->bconsoleCommand( + $this->director, + ['.schedule'], + null, + true + ); + if ($result->exitcode === 0) { + if (in_array($schedule_name, $result->output)) { + $component_type = 'dir'; + $resource_type = 'schedule'; + $resource_name = $schedule_name; + + $result = $this->getModule('disable')->disable( + $this->director, + $component_type, + $resource_type, + $resource_name + ); + $output = $result->output; + $error = $result->exitcode; + if ($error != 0) { + $output = GenericError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $error = GenericError::ERROR_WRONG_EXITCODE; + } + $this->output = $output; + $this->error = $error; + } else { + $this->output = GenericError::MSG_ERROR_INVALID_PROPERTY; + $this->error = GenericError::ERROR_INVALID_PROPERTY; + } + } else { + $this->output = GenericError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $this->error = GenericError::ERROR_WRONG_EXITCODE; + } + } +} +?> diff --git a/gui/baculum/protected/API/Pages/API/DisableStorage.php b/gui/baculum/protected/API/Pages/API/DisableStorage.php new file mode 100644 index 000000000..c028cc56e --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/DisableStorage.php @@ -0,0 +1,82 @@ + + * @category API + * @package Baculum API + */ +class DisableStorage extends BaculumAPIServer { + + public function set($id, $params) { + $storageid = (int) $id; + $drive = $this->Request->contains('drive') ? (int) $this->Request['drive'] : 0; + $storage_mod = $this->getModule('storage'); + $storage = null; + if ($storageid > 0) { + $storage = $storage_mod->getStorageById($storageid); + } + + $result = $this->getModule('bconsole')->bconsoleCommand( + $this->director, + ['.storage'], + null, + true + ); + if ($result->exitcode === 0) { + if (is_object($storage) && in_array($storage->name, $result->output)) { + $component_type = 'dir'; + $resource_type = 'storage'; + $resource_name = $storage->name; + $params = ["drive=\"$drive\""]; + + $result = $this->getModule('disable')->disable( + $this->director, + $component_type, + $resource_type, + $resource_name, + $params + ); + $output = $result->output; + $error = $result->exitcode; + if ($error != 0) { + $output = StorageError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $error = StorageError::ERROR_WRONG_EXITCODE; + } + $this->output = $output; + $this->error = $error; + } else { + $this->output = StorageError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS; + $this->error = StorageError::ERROR_STORAGE_DOES_NOT_EXISTS; + } + } else { + $this->output = StorageError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $this->error = StorageError::ERROR_WRONG_EXITCODE; + } + } +} +?> diff --git a/gui/baculum/protected/API/Pages/API/EnableClient.php b/gui/baculum/protected/API/Pages/API/EnableClient.php new file mode 100644 index 000000000..e25fd008d --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/EnableClient.php @@ -0,0 +1,79 @@ + + * @category API + * @package Baculum API + */ +class EnableClient extends BaculumAPIServer { + + public function set($id, $params) { + $clientid = (int) $id; + $client_mod = $this->getModule('client'); + $client = null; + if ($clientid > 0) { + $client = $client_mod->getClientById($clientid); + } + + $result = $this->getModule('bconsole')->bconsoleCommand( + $this->director, + ['.client'], + null, + true + ); + if ($result->exitcode === 0) { + if (is_object($client) && in_array($client->name, $result->output)) { + $component_type = 'dir'; + $resource_type = 'client'; + $resource_name = $client->name; + + $result = $this->getModule('enable')->enable( + $this->director, + $component_type, + $resource_type, + $resource_name + ); + $output = $result->output; + $error = $result->exitcode; + if ($error != 0) { + $output = ClientError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $error = ClientError::ERROR_WRONG_EXITCODE; + } + $this->output = $output; + $this->error = $error; + } else { + $this->output = ClientError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS; + $this->error = ClientError::ERROR_CLIENT_DOES_NOT_EXISTS; + } + } else { + $this->output = ClientError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $this->error = ClientError::ERROR_WRONG_EXITCODE; + } + } +} +?> diff --git a/gui/baculum/protected/API/Pages/API/EnableJob.php b/gui/baculum/protected/API/Pages/API/EnableJob.php new file mode 100644 index 000000000..25af7e83f --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/EnableJob.php @@ -0,0 +1,79 @@ + + * @category API + * @package Baculum API + */ +class EnableJob extends BaculumAPIServer { + + public function set($id, $params) { + $jobid = (int) $id; + $job_mod = $this->getModule('job'); + $job = null; + if ($jobid > 0) { + $job = $job_mod->getJobById($jobid); + } + + $result = $this->getModule('bconsole')->bconsoleCommand( + $this->director, + ['.jobs'], + null, + true + ); + if ($result->exitcode === 0) { + if (is_object($job) && in_array($job->name, $result->output)) { + $component_type = 'dir'; + $resource_type = 'job'; + $resource_name = $job->name; + + $result = $this->getModule('enable')->enable( + $this->director, + $component_type, + $resource_type, + $resource_name + ); + $output = $result->output; + $error = $result->exitcode; + if ($error != 0) { + $output = JobError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $error = JobError::ERROR_WRONG_EXITCODE; + } + $this->output = $output; + $this->error = $error; + } else { + $this->output = JobError::MSG_ERROR_JOB_DOES_NOT_EXISTS; + $this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS; + } + } else { + $this->output = JobError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $this->error = JobError::ERROR_WRONG_EXITCODE; + } + } +} +?> diff --git a/gui/baculum/protected/API/Pages/API/EnableSchedule.php b/gui/baculum/protected/API/Pages/API/EnableSchedule.php new file mode 100644 index 000000000..59d3e6dd2 --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/EnableSchedule.php @@ -0,0 +1,75 @@ + + * @category API + * @package Baculum API + */ +class EnableSchedule extends BaculumAPIServer { + + public function set($id, $params) { + $misc = $this->getModule('misc'); + $schedule_name = $this->Request->contains('name') && $misc->isValidName($this->Request['name']) ? $this->Request['name'] : ''; + + $result = $this->getModule('bconsole')->bconsoleCommand( + $this->director, + ['.schedule'], + null, + true + ); + if ($result->exitcode === 0) { + if (in_array($schedule_name, $result->output)) { + $component_type = 'dir'; + $resource_type = 'schedule'; + $resource_name = $schedule_name; + + $result = $this->getModule('enable')->enable( + $this->director, + $component_type, + $resource_type, + $resource_name + ); + $output = $result->output; + $error = $result->exitcode; + if ($error != 0) { + $output = GenericError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $error = GenericError::ERROR_WRONG_EXITCODE; + } + $this->output = $output; + $this->error = $error; + } else { + $this->output = GenericError::MSG_ERROR_INVALID_PROPERTY; + $this->error = GenericError::ERROR_INVALID_PROPERTY; + } + } else { + $this->output = GenericError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $this->error = GenericError::ERROR_WRONG_EXITCODE; + } + } +} +?> diff --git a/gui/baculum/protected/API/Pages/API/EnableStorage.php b/gui/baculum/protected/API/Pages/API/EnableStorage.php new file mode 100644 index 000000000..8b6b31109 --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/EnableStorage.php @@ -0,0 +1,82 @@ + + * @category API + * @package Baculum API + */ +class EnableStorage extends BaculumAPIServer { + + public function set($id, $params) { + $storageid = (int) $id; + $drive = $this->Request->contains('drive') ? (int) $this->Request['drive'] : 0; + $storage_mod = $this->getModule('storage'); + $storage = null; + if ($storageid > 0) { + $storage = $storage_mod->getStorageById($storageid); + } + + $result = $this->getModule('bconsole')->bconsoleCommand( + $this->director, + ['.storage'], + null, + true + ); + if ($result->exitcode === 0) { + if (is_object($storage) && in_array($storage->name, $result->output)) { + $component_type = 'dir'; + $resource_type = 'storage'; + $resource_name = $storage->name; + + $params = ["drive=\"$drive\""]; + $result = $this->getModule('enable')->enable( + $this->director, + $component_type, + $resource_type, + $resource_name, + $params + ); + $output = $result->output; + $error = $result->exitcode; + if ($error != 0) { + $output = StorageError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $error = StorageError::ERROR_WRONG_EXITCODE; + } + $this->output = $output; + $this->error = $error; + } else { + $this->output = StorageError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS; + $this->error = StorageError::ERROR_STORAGE_DOES_NOT_EXISTS; + } + } else { + $this->output = StorageError::MSG_ERROR_WRONG_EXITCODE . 'Exitcode=>' . $result->exitcode. ', Output=>' . print_r($result->output, true); + $this->error = StorageError::ERROR_WRONG_EXITCODE; + } + } +} +?> diff --git a/gui/baculum/protected/API/Pages/API/config.xml b/gui/baculum/protected/API/Pages/API/config.xml index c1f8442a7..1b6fea872 100644 --- a/gui/baculum/protected/API/Pages/API/config.xml +++ b/gui/baculum/protected/API/Pages/API/config.xml @@ -61,6 +61,8 @@ + + diff --git a/gui/baculum/protected/API/Pages/API/endpoints.xml b/gui/baculum/protected/API/Pages/API/endpoints.xml index cb07855a2..f853d3888 100644 --- a/gui/baculum/protected/API/Pages/API/endpoints.xml +++ b/gui/baculum/protected/API/Pages/API/endpoints.xml @@ -29,6 +29,8 @@ + + @@ -39,6 +41,8 @@ + + @@ -89,6 +93,8 @@ + + @@ -134,6 +140,8 @@ + + diff --git a/gui/baculum/protected/API/openapi_baculum.json b/gui/baculum/protected/API/openapi_baculum.json index f91fcc853..8234d59cb 100644 --- a/gui/baculum/protected/API/openapi_baculum.json +++ b/gui/baculum/protected/API/openapi_baculum.json @@ -895,6 +895,72 @@ ] } }, + "/api/v2/clients/{clientid}/enable": { + "put": { + "tags": ["clients"], + "summary": "Enable client.", + "description": "Enable client", + "responses": { + "200": { + "description": "Enable client", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "array", + "items": { + "type": "string", + "description": "Enable client output" + } + }, + "error": { + "type": "integer", + "description": "Error code", + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 1000] + } + } + } + } + } + } + } + } + }, + "/api/v2/clients/{clientid}/disable": { + "put": { + "tags": ["clients"], + "summary": "Disable client.", + "description": "Disable client", + "responses": { + "200": { + "description": "Disable client", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "array", + "items": { + "type": "string", + "description": "Disable client output" + } + }, + "error": { + "type": "integer", + "description": "Error code", + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 1000] + } + } + } + } + } + } + } + } + }, "/api/v2/clients/resnames": { "get": { "tags": ["clients"], @@ -1578,6 +1644,72 @@ ] } }, + "/api/v2/jobs/{jobid}/enable": { + "put": { + "tags": ["jobs"], + "summary": "Enable job.", + "description": "Enable job", + "responses": { + "200": { + "description": "Enable job", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "array", + "items": { + "type": "string", + "description": "Enable job output" + } + }, + "error": { + "type": "integer", + "description": "Error code", + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 50, 11, 1000] + } + } + } + } + } + } + } + } + }, + "/api/v2/jobs/{jobid}/disable": { + "put": { + "tags": ["jobs"], + "summary": "Disable job.", + "description": "Disable job", + "responses": { + "200": { + "description": "Disable job", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "array", + "items": { + "type": "string", + "description": "Disable job output" + } + }, + "error": { + "type": "integer", + "description": "Error code", + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 50, 11, 1000] + } + } + } + } + } + } + } + } + }, "/api/v2/jobs/{jobid}/files": { "get": { "tags": ["jobs"], @@ -3588,6 +3720,94 @@ ] } }, + "/api/v2/storages/{storageid}/enable": { + "put": { + "tags": ["storages"], + "summary": "Enable storage.", + "description": "Enable storage", + "responses": { + "200": { + "description": "Enable storage", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "array", + "items": { + "type": "string", + "description": "Enable storage output" + } + }, + "error": { + "type": "integer", + "description": "Error code", + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 20, 11, 1000] + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "drive", + "in": "query", + "description": "Storage drive (default 0)", + "required": false, + "schema": { + "type": "integer" + } + } + ] + } + }, + "/api/v2/storages/{storageid}/disable": { + "put": { + "tags": ["storages"], + "summary": "Disable storage.", + "description": "Disable storage", + "responses": { + "200": { + "description": "Disable storage", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "array", + "items": { + "type": "string", + "description": "Disable storage output" + } + }, + "error": { + "type": "integer", + "description": "Error code", + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 20, 11, 1000] + } + } + } + } + } + } + }, + "parameters": [ + { + "name": "drive", + "in": "query", + "description": "Storage drive (default 0)", + "required": false, + "schema": { + "type": "integer" + } + } + ] + } + }, "/api/v2/storages/{storageid}/release": { "get": { "tags": ["storages"], @@ -5911,6 +6131,72 @@ ] } }, + "/api/v2/schedules/{schedule_name}/enable": { + "put": { + "tags": ["schedules"], + "summary": "Enable schedule.", + "description": "Enable schedule", + "responses": { + "200": { + "description": "Enable schedule", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "array", + "items": { + "type": "string", + "description": "Enable schedule output" + } + }, + "error": { + "type": "integer", + "description": "Error code", + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 520, 11, 1000] + } + } + } + } + } + } + } + } + }, + "/api/v2/schedules/{schedule_name}/disable": { + "put": { + "tags": ["schedules"], + "summary": "Disable schedule.", + "description": "Disable schedule", + "responses": { + "200": { + "description": "Disable schedule", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "output": { + "type": "array", + "items": { + "type": "string", + "description": "Disable schedule output" + } + }, + "error": { + "type": "integer", + "description": "Error code", + "enum": [0, 1, 2, 3, 4, 5, 6, 7, 520, 11, 1000] + } + } + } + } + } + } + } + } + }, "/api/v2/bvfs/update": { "put": { "tags": ["bvfs"], -- 2.47.3