summaryrefslogtreecommitdiff
path: root/redfish-core/lib/log_services.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'redfish-core/lib/log_services.hpp')
-rw-r--r--redfish-core/lib/log_services.hpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 8590373267..df6e210f03 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -156,8 +156,6 @@ inline void deleteSystemDumpEntry(crow::Response &res,
boost::beast::http::status::internal_server_error);
return;
}
-
- asyncResp->res.result(boost::beast::http::status::ok);
};
crow::connections::systemBus->async_method_call(
respHandler, "xyz.openbmc_project.Dump.Manager",
@@ -1880,6 +1878,54 @@ class SystemDumpEntryDownload : public Node
}
};
+class SystemDumpClear : public Node
+{
+ public:
+ SystemDumpClear(CrowApp &app) :
+ Node(app, "/redfish/v1/Systems/system/LogServices/System/"
+ "Actions/"
+ "LogService.ClearLog/")
+ {
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
+ {boost::beast::http::verb::head, {{"Login"}}},
+ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
+ }
+
+ private:
+ void doPost(crow::Response &res, const crow::Request &req,
+ const std::vector<std::string> &params) override
+ {
+
+ auto asyncResp = std::make_shared<AsyncResp>(res);
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const std::vector<std::string> &dumpList) {
+ if (ec)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ for (const std::string &objectPath : dumpList)
+ {
+ std::size_t pos = objectPath.rfind("/");
+ if (pos != std::string::npos)
+ {
+ std::string logID = objectPath.substr(pos + 1);
+ deleteSystemDumpEntry(asyncResp->res, logID);
+ }
+ }
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
+ "/xyz/openbmc_project/dump", 0,
+ std::array<const char *, 1>{
+ "xyz.openbmc_project.Dump.Entry.System"});
+ }
+};
+
class CrashdumpService : public Node
{
public: