blob: d8038ba391f8d22ecba09896d0012281402d195e [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)
George Liu3fe976c2022-06-21 09:37:04 +080037 {}
Matt Spinler56fd8332017-10-31 14:00:18 -050038
Brad Bishopd1eac882018-03-29 10:34:05 -040039 /**
40 * @brief Callback interface to resolve errors
41 *
42 * Resolves all error log entries that are associated
43 * with the callout.
44 */
45 void operator()(Context ctx) override;
Matt Spinler56fd8332017-10-31 14:00:18 -050046
Brad Bishopd1eac882018-03-29 10:34:05 -040047 private:
48 /**
49 * @brief Resolves a single error log entry
50 *
51 * param[in] entry - the object path of the error log entry
52 */
53 void resolve(const std::string& entry);
Matt Spinler56fd8332017-10-31 14:00:18 -050054
Brad Bishopd1eac882018-03-29 10:34:05 -040055 /**
56 * @brief The object path of the callout, typically an inventory path
57 */
58 std::string callout;
Matt Spinler56fd8332017-10-31 14:00:18 -050059};
60
Matt Spinler56fd8332017-10-31 14:00:18 -050061} // namespace monitoring
62} // namespace dbus
63} // namespace phosphor