1 /* 2 BAREOS® - Backup Archiving REcovery Open Sourced 3 4 Copyright (C) 2018-2018 Bareos GmbH & Co. KG 5 6 This program is Free Software; you can redistribute it and/or 7 modify it under the terms of version three of the GNU Affero General Public 8 License as published by the Free Software Foundation and included 9 in the file LICENSE. 10 11 This program is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Affero General Public License for more details. 15 16 You should have received a copy of the GNU Affero General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 02110-1301, USA. 20 */ 21 22 #ifndef BAREOS_DIRD_UA_SELECT_H_ 23 #define BAREOS_DIRD_UA_SELECT_H_ 24 25 #include "dird/ua.h" 26 class alist; 27 28 namespace directordaemon { 29 30 StorageResource* select_storage_resource(UaContext* ua, 31 bool autochanger_only = false); 32 JobResource* select_job_resource(UaContext* ua); 33 JobResource* select_enable_disable_job_resource(UaContext* ua, bool enable); 34 JobResource* select_restore_job_resource(UaContext* ua); 35 ClientResource* select_client_resource(UaContext* ua); 36 ClientResource* select_enable_disable_client_resource(UaContext* ua, 37 bool enable); 38 FilesetResource* select_fileset_resource(UaContext* ua); 39 ScheduleResource* select_enable_disable_schedule_resource(UaContext* ua, 40 bool enable); 41 bool SelectPoolAndMediaDbr(UaContext* ua, PoolDbRecord* pr, MediaDbRecord* mr); 42 bool SelectMediaDbr(UaContext* ua, MediaDbRecord* mr); 43 bool SelectPoolDbr(UaContext* ua, PoolDbRecord* pr, const char* argk = "pool"); 44 bool SelectStorageDbr(UaContext* ua, 45 StorageDbRecord* pr, 46 const char* argk = "storage"); 47 bool SelectClientDbr(UaContext* ua, ClientDbRecord* cr); 48 49 void StartPrompt(UaContext* ua, const char* msg); 50 void AddPrompt(UaContext* ua, const char* prompt); 51 void AddPrompt(UaContext* ua, std::string&& prompt); 52 int DoPrompt(UaContext* ua, 53 const char* automsg, 54 const char* msg, 55 char* prompt, 56 int max_prompt); 57 CatalogResource* get_catalog_resource(UaContext* ua); 58 StorageResource* get_storage_resource(UaContext* ua, 59 bool use_default = false, 60 bool autochanger_only = false); 61 drive_number_t GetStorageDrive(UaContext* ua, StorageResource* store); 62 slot_number_t GetStorageSlot(UaContext* ua, StorageResource* store); 63 int GetMediaType(UaContext* ua, char* MediaType, int max_media); 64 bool GetPoolDbr(UaContext* ua, PoolDbRecord* pr, const char* argk = "pool"); 65 bool GetStorageDbr(UaContext* ua, 66 StorageDbRecord* sr, 67 const char* argk = "storage"); 68 bool GetClientDbr(UaContext* ua, ClientDbRecord* cr); 69 PoolResource* get_pool_resource(UaContext* ua); 70 JobResource* get_restore_job(UaContext* ua); 71 PoolResource* select_pool_resource(UaContext* ua); 72 alist* select_jobs(UaContext* ua, const char* reason); 73 ClientResource* get_client_resource(UaContext* ua); 74 int GetJobDbr(UaContext* ua, JobDbRecord* jr); 75 bool GetUserSlotList(UaContext* ua, 76 char* slot_list, 77 const char* argument, 78 int num_slots); 79 bool GetUserJobTypeSelection(UaContext* ua, int* jobtype); 80 bool GetUserJobStatusSelection(UaContext* ua, int* jobstatus); 81 bool GetUserJobLevelSelection(UaContext* ua, int* joblevel); 82 83 int FindArgKeyword(UaContext* ua, const char** list); 84 int FindArg(UaContext* ua, const char* keyword); 85 int FindArgWithValue(UaContext* ua, const char* keyword); 86 int DoKeywordPrompt(UaContext* ua, const char* msg, const char** list); 87 bool ConfirmRetention(UaContext* ua, utime_t* ret, const char* msg); 88 bool GetLevelFromName(JobControlRecord* jcr, const char* level_name); 89 90 91 } /* namespace directordaemon */ 92 #endif // BAREOS_DIRD_UA_SELECT_H_ 93