--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2021 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+/**
+ * Console messages.
+ *
+ * @author Marcin Haba <marcin.haba@bacula.pl>
+ * @category API
+ * @package Baculum API
+ */
+class Messages extends BaculumAPIServer {
+
+ public function get() {
+ $misc = $this->getModule('misc');
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
+
+ $cmd = ['messages'];
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd, null, true);
+ $output = $result->output;
+ if ($result->exitcode == 0) {
+ $output = $limit > 0 ? array_slice($output, -$limit) : $output;
+ }
+ $this->output = $output;
+ $this->error = $result->exitcode > 0 ? GenericError::ERROR_WRONG_EXITCODE : GenericError::ERROR_NO_ERRORS;
+ }
+}
+?>
<url ServiceParameter="BVFSCleanUp" pattern="api/v1/bvfs/cleanup/" />
<!-- joblog endpoints -->
<url ServiceParameter="JobLog" pattern="api/v1/joblog/{id}/" parameters.id="\d+" />
+ <!-- @TODO: Separate this endpoint outside 'joblog' -->
+ <url ServiceParameter="Messages" pattern="api/v1/joblog/messages" />
<!-- fileset endpoints -->
<url ServiceParameter="FileSets" pattern="api/v1/filesets/" />
<url ServiceParameter="FileSet" pattern="api/v1/filesets/{id}/" parameters.id="\d+" />
}]
}
},
+ "/api/v1/joblog/messages": {
+ "get": {
+ "tags": ["joblog"],
+ "summary": "Get console messages log.",
+ "description": "Get messages log. Note, because there are returned all current Bacula messages, this endpoint should not be shared non-admin users.",
+ "responses": {
+ "200": {
+ "description": "Job messages log output",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "output": {
+ "type": "array",
+ "items": {
+ "description": "Job log output",
+ "type": "string"
+ }
+ },
+ "error": {
+ "type": "integer",
+ "description": "Error code",
+ "enum": [0, 1, 4, 5, 6, 7, 9, 11, 1000]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "parameters": [{
+ "name": "limit",
+ "in": "query",
+ "description": "Set messages log Limit.",
+ "required": false,
+ "default": 0,
+ "schema": {
+ "type": "integer"
+ }
+ }]
+ }
+ },
"/api/v1/status/director": {
"get": {
"tags": ["status"],