]> granicus.if.org Git - icinga2/blob - lib/icinga/compatutility.hpp
Merge pull request #6727 from Icinga/feature/cluster-config-sync-stage
[icinga2] / lib / icinga / compatutility.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef COMPATUTILITY_H
4 #define COMPATUTILITY_H
5
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/host.hpp"
8 #include "icinga/command.hpp"
9
10 namespace icinga
11 {
12
13 /**
14  * Compatibility utility functions.
15  *
16  * @ingroup icinga
17  */
18 class CompatUtility
19 {
20 public:
21         /* command */
22         static String GetCommandLine(const Command::Ptr& command);
23         static String GetCommandName(const Command::Ptr& command);
24
25         /* service */
26         static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
27
28         /* notification */
29         static int GetCheckableNotificationsEnabled(const Checkable::Ptr& checkable);
30         static int GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable);
31         static int GetCheckableNotificationNextNotification(const Checkable::Ptr& checkable);
32         static int GetCheckableNotificationNotificationNumber(const Checkable::Ptr& checkable);
33         static double GetCheckableNotificationNotificationInterval(const Checkable::Ptr& checkable);
34         static int GetCheckableNotificationTypeFilter(const Checkable::Ptr& checkable);
35         static int GetCheckableNotificationStateFilter(const Checkable::Ptr& checkable);
36
37         static std::set<User::Ptr> GetCheckableNotificationUsers(const Checkable::Ptr& checkable);
38         static std::set<UserGroup::Ptr> GetCheckableNotificationUserGroups(const Checkable::Ptr& checkable);
39
40         /* check result */
41         static String GetCheckResultOutput(const CheckResult::Ptr& cr);
42         static String GetCheckResultLongOutput(const CheckResult::Ptr& cr);
43
44         /* misc */
45         static String EscapeString(const String& str);
46         static String UnEscapeString(const String& str);
47
48 private:
49         CompatUtility();
50
51         static String GetCommandNamePrefix(const Command::Ptr& command);
52 };
53
54 }
55
56 #endif /* COMPATUTILITY_H */