blob: 2133d1e8bfb51e42cef58993178abf25310df596 [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 */
Patrick Williamsc5fe26a2023-05-10 07:50:25 -050036 explicit ResolveCallout(const std::string& callout) : callout(callout) {}
Matt Spinler56fd8332017-10-31 14:00:18 -050037
Brad Bishopd1eac882018-03-29 10:34:05 -040038 /**
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;
Matt Spinler56fd8332017-10-31 14:00:18 -050045
Brad Bishopd1eac882018-03-29 10:34:05 -040046 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);
Matt Spinler56fd8332017-10-31 14:00:18 -050053
Brad Bishopd1eac882018-03-29 10:34:05 -040054 /**
55 * @brief The object path of the callout, typically an inventory path
56 */
57 std::string callout;
Matt Spinler56fd8332017-10-31 14:00:18 -050058};
59
Matt Spinler56fd8332017-10-31 14:00:18 -050060} // namespace monitoring
61} // namespace dbus
62} // namespace phosphor