// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright OpenBMC Authors // SPDX-FileCopyrightText: Copyright 2018 Intel Corporation #pragma once #include "app.hpp" #include "async_resp.hpp" #include "error_messages.hpp" #include "http_request.hpp" #include "query.hpp" #include "registries/privilege_registry.hpp" #include "utils/eventlog_utils.hpp" #include "utils/query_param.hpp" #include #include #include #include #include #include #include #include #include #include namespace redfish { inline void handleManagersLogServiceEventLogLogEntryCollection( crow::App& app, const crow::Request& req, const std::shared_ptr& asyncResp, const std::string& managerId) { query_param::QueryCapabilities capabilities = { .canDelegateTop = true, .canDelegateSkip = true, }; query_param::Query delegatedQuery; if (!redfish::setUpRedfishRouteWithDelegation(app, req, asyncResp, delegatedQuery, capabilities)) { return; } if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME) { messages::resourceNotFound(asyncResp->res, "Manager", managerId); return; } eventlog_utils:: handleSystemsAndManagersLogServiceEventLogLogEntryCollection( asyncResp, delegatedQuery, eventlog_utils::LogServiceParent::Managers); } inline void handleManagersJournalEventLogEntry( crow::App& app, const crow::Request& req, const std::shared_ptr& asyncResp, const std::string& managerId, const std::string& param) { if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME) { messages::resourceNotFound(asyncResp->res, "Manager", managerId); return; } eventlog_utils::handleSystemsAndManagersLogServiceEventLogEntriesGet( asyncResp, param, eventlog_utils::LogServiceParent::Managers); } inline void handleManagersJournalEventLogClear( crow::App& app, const crow::Request& req, const std::shared_ptr& asyncResp, const std::string& managerId) { if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME) { messages::resourceNotFound(asyncResp->res, "Manager", managerId); return; } eventlog_utils::handleSystemsAndManagersLogServicesEventLogActionsClearPost( asyncResp); } inline void requestRoutesManagersJournalEventLog(App& app) { BMCWEB_ROUTE(app, "/redfish/v1/Managers//LogServices/EventLog/Entries/") .privileges(redfish::privileges::getLogEntryCollection) .methods(boost::beast::http::verb::get)(std::bind_front( handleManagersLogServiceEventLogLogEntryCollection, std::ref(app))); BMCWEB_ROUTE( app, "/redfish/v1/Managers//LogServices/EventLog/Entries//") .privileges(redfish::privileges::getLogEntry) .methods(boost::beast::http::verb::get)( std::bind_front(handleManagersJournalEventLogEntry, std::ref(app))); BMCWEB_ROUTE( app, "/redfish/v1/Managers//LogServices/EventLog/Actions/LogService.ClearLog/") .privileges(redfish::privileges:: postLogServiceSubOverComputerSystemLogServiceCollection) .methods(boost::beast::http::verb::post)( std::bind_front(handleManagersJournalEventLogClear, std::ref(app))); } } // namespace redfish