xref: /openbmc/phosphor-dbus-monitor/src/resolve_errors.hpp (revision 98d6462a0b8a62aeeb2b50785f3c5309c8a9505e)
1 #pragma once
2 #include "callback.hpp"
3 
4 #include <string>
5 
6 namespace phosphor
7 {
8 namespace dbus
9 {
10 namespace monitoring
11 {
12 
13 /**
14  * @class ResolveCallout
15  * @brief Resolves error logs with the associated callout
16  *
17  * Resolves a log by setting its Resolved property
18  * to true.
19  */
20 class ResolveCallout : public Callback
21 {
22   public:
23     ResolveCallout() = delete;
24     ~ResolveCallout() = default;
25     ResolveCallout(const ResolveCallout&) = delete;
26     ResolveCallout& operator=(const ResolveCallout&) = delete;
27     ResolveCallout(ResolveCallout&&) = default;
28     ResolveCallout& operator=(ResolveCallout&&) = default;
29 
30     /**
31      * @brief constructor
32      *
33      * @param[in] callout - The callout whose errors need to be resolved.
34      *                      Normally an inventory path.
35      */
36     explicit ResolveCallout(const std::string& callout) : callout(callout)
37     {
38     }
39 
40     /**
41      * @brief Callback interface to resolve errors
42      *
43      * Resolves all error log entries that are associated
44      * with the callout.
45      */
46     void operator()(Context ctx) override;
47 
48   private:
49     /**
50      * @brief Resolves a single error log entry
51      *
52      * param[in] entry - the object path of the error log entry
53      */
54     void resolve(const std::string& entry);
55 
56     /**
57      * @brief The object path of the callout, typically an inventory path
58      */
59     std::string callout;
60 };
61 
62 } // namespace monitoring
63 } // namespace dbus
64 } // namespace phosphor
65