blob: 979261a2acd7372100bd3de373376cbd8cb05a3b [file] [log] [blame]
Matt Spinler56fd8332017-10-31 14:00:18 -05001#pragma once
2#include "callback.hpp"
3
Andrew Geisslerae4c95c2020-05-16 13:58:53 -05004#include <string>
5
Matt Spinler56fd8332017-10-31 14:00:18 -05006namespace phosphor
7{
8namespace dbus
9{
10namespace 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 */
20class ResolveCallout : public Callback
21{
Brad Bishopd1eac882018-03-29 10:34:05 -040022 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;
Matt Spinler56fd8332017-10-31 14:00:18 -050029
Brad Bishopd1eac882018-03-29 10:34:05 -040030 /**
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 }
Matt Spinler56fd8332017-10-31 14:00:18 -050039
Brad Bishopd1eac882018-03-29 10:34:05 -040040 /**
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;
Matt Spinler56fd8332017-10-31 14:00:18 -050047
Brad Bishopd1eac882018-03-29 10:34:05 -040048 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);
Matt Spinler56fd8332017-10-31 14:00:18 -050055
Brad Bishopd1eac882018-03-29 10:34:05 -040056 /**
57 * @brief The object path of the callout, typically an inventory path
58 */
59 std::string callout;
Matt Spinler56fd8332017-10-31 14:00:18 -050060};
61
Matt Spinler56fd8332017-10-31 14:00:18 -050062} // namespace monitoring
63} // namespace dbus
64} // namespace phosphor