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