$this->error = VolumeError::ERROR_VOLUME_DOES_NOT_EXISTS;
}
}
+
+ public function remove() {
+ $mediaid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
+ $volume = $this->getModule('volume')->getVolumeById($mediaid);
+ if (is_object($volume)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ [
+ 'delete',
+ 'volume="' . $volume->volumename . '"',
+ 'yes'
+ ]
+ );
+ if ($result->exitcode === 0) {
+ $this->output = $result->output;
+ $this->error = VolumeError::ERROR_NO_ERRORS;
+ } else {
+ $this->output = $result->output;
+ $this->error = VolumeError::ERROR_WRONG_EXITCODE;
+ }
+ } else {
+ $this->output = VolumeError::MSG_ERROR_VOLUME_DOES_NOT_EXISTS;
+ $this->error = VolumeError::ERROR_VOLUME_DOES_NOT_EXISTS;
+ }
+ }
}
?>
}
}
]
+ },
+ "delete": {
+ "tags": ["volumes"],
+ "summary": "Delete volume by MediaId",
+ "description": "Delete volume from the Catalog by specific Volume/Media identifier.",
+ "responses": {
+ "200": {
+ "description": "Volume delete output",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "output": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "description": "Delete volume output"
+ }
+ },
+ "error": {
+ "type": "integer",
+ "description": "Error code",
+ "enum": [0, 1, 2, 3, 4, 5, 6, 7, 11, 30, 1000]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/MediaId"
+ }
+ ]
}
},
"/api/v2/volumes/{mediaid}/prune": {