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      */
ResolveCallout(const std::string & callout)36     explicit ResolveCallout(const std::string& callout) : callout(callout) {}
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