3 * Bacula(R) - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2016 Kern Sibbald
8 * The main author of Baculum is Marcin Haba.
9 * The original author of Bacula is Kern Sibbald, with contributions
10 * from many others, a complete list can be found in the file AUTHORS.
12 * You may use this file and others of this release according to the
13 * license defined in the LICENSE file, which includes the Affero General
14 * Public License, v3.0 ("AGPLv3") and some additional permissions and
15 * terms pursuant to its AGPLv3 Section 7.
17 * This notice must be preserved when any source code is
18 * conveyed and/or propagated.
20 * Bacula(R) is a registered trademark of Kern Sibbald.
24 const ERROR_NO_ERRORS = 0;
25 const ERROR_INVALID_COMMAND = 1;
26 const ERROR_INTERNAL_ERROR = 1000;
28 const MSG_ERROR_NO_ERRORS = '';
29 const MSG_ERROR_INVALID_COMMAND = 'Invalid command.';
30 const MSG_ERROR_INTERNAL_ERROR = 'Internal error.';
33 class DatabaseError extends GenericError {
34 const ERROR_DB_CONNECTION_PROBLEM = 2;
35 const ERROR_DATABASE_ACCESS_NOT_SUPPORTED = 3;
37 const MSG_ERROR_DB_CONNECTION_PROBLEM = 'Problem with connection to database.';
38 const MSG_ERROR_DATABASE_ACCESS_NOT_SUPPORTED = 'Database access is not supported by this API instance.';
41 class BconsoleError extends GenericError {
43 const ERROR_BCONSOLE_CONNECTION_PROBLEM = 4;
44 const ERROR_INVALID_DIRECTOR = 5;
46 const MSG_ERROR_BCONSOLE_CONNECTION_PROBLEM = 'Problem with connection to bconsole.';
47 const MSG_ERROR_INVALID_DIRECTOR = 'Invalid director.';
50 class AuthorizationError extends GenericError {
52 const ERROR_AUTHORIZATION_TO_API_PROBLEM = 6;
53 const ERROR_ACCESS_ATTEMPT_TO_NOT_ALLOWED_RESOURCE = 7;
55 const MSG_ERROR_AUTHORIZATION_TO_API_PROBLEM = 'Problem with authorization to Baculum API.';
56 const MSG_ERROR_ACCESS_ATTEMPT_TO_NOT_ALLOWED_RESOURCE = 'Access attempt to not allowed resource. Permission denied.';
59 class ClientError extends GenericError {
60 const ERROR_CLIENT_DOES_NOT_EXISTS = 10;
62 const MSG_ERROR_CLIENT_DOES_NOT_EXISTS = 'Client with inputted clientid does not exist.';
65 class StorageError extends GenericError {
66 const ERROR_STORAGE_DOES_NOT_EXISTS = 20;
68 const MSG_ERROR_STORAGE_DOES_NOT_EXISTS = 'Storage with inputted storageid does not exist.';
71 class VolumeError extends GenericError {
72 const ERROR_VOLUME_DOES_NOT_EXISTS = 30;
74 const MSG_ERROR_VOLUME_DOES_NOT_EXISTS = 'Volume with inputted mediaid does not exist.';
77 class PoolError extends GenericError {
78 const ERROR_POOL_DOES_NOT_EXISTS = 40;
79 const ERROR_NO_VOLUMES_IN_POOL_TO_UPDATE = 41;
81 const MSG_ERROR_POOL_DOES_NOT_EXISTS = 'Pool with inputted poolid does not exist.';
82 const MSG_ERROR_NO_VOLUMES_IN_POOL_TO_UPDATE= 'Pool with inputted poolid does not contain any volume to update.';
85 class JobError extends GenericError {
86 const ERROR_JOB_DOES_NOT_EXISTS = 50;
87 const ERROR_INVALID_JOBLEVEL = 51;
88 const ERROR_FILESET_DOES_NOT_EXISTS = 52;
89 const ERROR_CLIENT_DOES_NOT_EXISTS = 53;
90 const ERROR_STORAGE_DOES_NOT_EXISTS = 54;
91 const ERROR_POOL_DOES_NOT_EXISTS = 55;
92 const ERROR_INVALID_RPATH = 56;
93 const ERROR_INVALID_WHERE_OPTION = 57;
94 const ERROR_INVALID_REPLACE_OPTION = 58;
96 const MSG_ERROR_JOB_DOES_NOT_EXISTS = 'Job with inputted jobid does not exist.';
97 const MSG_ERROR_INVALID_JOBLEVEL = 'Inputted job level is invalid.';
98 const MSG_ERROR_FILESET_DOES_NOT_EXISTS = 'FileSet resource does not exist.';
99 const MSG_ERROR_CLIENT_DOES_NOT_EXISTS = 'Client does not exist.';
100 const MSG_ERROR_STORAGE_DOES_NOT_EXISTS = 'Storage does not exist.';
101 const MSG_ERROR_POOL_DOES_NOT_EXISTS = 'Pool does not exist.';
102 const MSG_ERROR_INVALID_RPATH = 'Inputted rpath for restore is invalid. Proper format is b2[0-9]+.';
103 const MSG_ERROR_INVALID_WHERE_OPTION = 'Inputted "where" option is invalid.';
104 const MSG_ERROR_INVALID_REPLACE_OPTION = 'Inputted "replace" option is invalid.';
107 class FileSetError extends GenericError {
108 const ERROR_FILESET_DOES_NOT_EXISTS = 60;
110 const MSG_ERROR_FILESET_DOES_NOT_EXISTS = 'FileSet with inputted filesetid does not exist.';
113 class BVFSError extends GenericError {
114 const ERROR_INVALID_JOBID_LIST = 70;
115 const ERROR_INVALID_RPATH = 71;
116 const ERROR_INVALID_RESTORE_PATH = 72;
117 const ERROR_INVALID_FILEID_LIST = 73;
118 const ERROR_INVALID_FILEINDEX_LIST = 74;
119 const ERROR_INVALID_DIRID_LIST = 75;
121 const MSG_ERROR_INVALID_JOBID_LIST = 'Invalid jobid list.';
122 const MSG_ERROR_INVALID_RPATH = 'Inputted path for restore is invalid. Proper format is b2[0-9]+.';
123 const MSG_ERROR_INVALID_RESTORE_PATH = 'Inputted BVFS path param is invalid.';
124 const MSG_ERROR_INVALID_FILEID_LIST = 'Invalid fileid list.';
125 const MSG_ERROR_INVALID_FILEINDEX_LIST = 'Invalid file index list.';
126 const MSG_ERROR_INVALID_DIRID_LIST = 'Invalid dirid list.';
129 class JSONToolsError extends GenericError {
131 const ERROR_JSON_TOOLS_DISABLED = 80;
132 const ERROR_JSON_TOOLS_CONNECTION_PROBLEM = 81;
133 const ERROR_JSON_TOOLS_WRONG_EXITCODE = 82;
134 const ERROR_JSON_TOOLS_UNABLE_TO_PARSE_OUTPUT = 83;
135 const ERROR_JSON_TOOL_NOT_CONFIGURED = 84;
138 const MSG_ERROR_JSON_TOOLS_DISABLED = 'JSON tools support is disabled.';
139 const MSG_ERROR_JSON_TOOLS_CONNECTION_PROBLEM = 'Problem with connection to a JSON tool.';
140 const MSG_ERROR_JSON_TOOLS_WRONG_EXITCODE = 'JSON tool returned wrong exitcode.';
141 const MSG_ERROR_JSON_TOOLS_UNABLE_TO_PARSE_OUTPUT = 'JSON tool output was unable to parse.';
142 const MSG_ERROR_JSON_TOOL_NOT_CONFIGURED = 'JSON tool not configured.';
145 class BaculaConfigError extends GenericError {
147 const ERROR_CONFIG_DIR_NOT_WRITABLE = 90;
148 const ERROR_UNEXPECTED_BACULA_CONFIG_VALUE = 91;
149 const ERROR_CONFIG_NO_JSONTOOL_READY = 92;
150 const ERROR_WRITE_TO_CONFIG_ERROR = 93;
151 const ERROR_CONFIG_VALIDATION_ERROR = 94;
153 const MSG_ERROR_CONFIG_DIR_NOT_WRITABLE = 'Config directory is not writable.';
154 const MSG_ERROR_UNEXPECTED_BACULA_CONFIG_VALUE = 'Unexpected Bacula config value.';
155 const MSG_ERROR_CONFIG_NO_JSONTOOL_READY = 'No JSON tool ready.';
156 const MSG_ERROR_WRITE_TO_CONFIG_ERROR = 'Write to config file error.';
157 const MSG_ERROR_CONFIG_VALIDATION_ERROR = 'Config validation error.';
160 class ConnectionError extends GenericError {
162 const ERROR_CONNECTION_TO_HOST_PROBLEM = 100;
164 const MSG_ERROR_CONNECTION_TO_HOST_PROBLEM = 'Problem with connection to remote host.';