// SPDX-License-Identifier: Apache-2.0 // SPDX-FileCopyrightText: Copyright OpenBMC Authors // SPDX-FileCopyrightText: Copyright 2018 Intel Corporation #pragma once #include "bmcweb_config.h" #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 handleSystemsLogServiceEventLogLogEntryCollection( crow::App& app, const crow::Request& req, const std::shared_ptr& asyncResp, const std::string& systemName) { query_param::QueryCapabilities capabilities = { .canDelegateTop = true, .canDelegateSkip = true, }; query_param::Query delegatedQuery; if (!redfish::setUpRedfishRouteWithDelegation(app, req, asyncResp, delegatedQuery, capabilities)) { return; } if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) { messages::resourceNotFound(asyncResp->res, "ComputerSystem", systemName); return; } if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) { messages::resourceNotFound(asyncResp->res, "ComputerSystem", systemName); return; } eventlog_utils:: handleSystemsAndManagersLogServiceEventLogLogEntryCollection( asyncResp, delegatedQuery, eventlog_utils::LogServiceParent::Systems); } inline void handleSystemsLogServiceEventLogEntriesGet( crow::App& app, const crow::Request& req, const std::shared_ptr& asyncResp, const std::string& systemName, const std::string& param) { if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) { messages::resourceNotFound(asyncResp->res, "ComputerSystem", systemName); return; } if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) { messages::resourceNotFound(asyncResp->res, "ComputerSystem", systemName); return; } eventlog_utils::handleSystemsAndManagersLogServiceEventLogEntriesGet( asyncResp, param, eventlog_utils::LogServiceParent::Systems); } inline void handleSystemsLogServicesEventLogActionsClearPost( crow::App& app, const crow::Request& req, const std::shared_ptr& asyncResp, const std::string& systemName) { if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) { messages::resourceNotFound(asyncResp->res, "ComputerSystem", systemName); return; } eventlog_utils::handleSystemsAndManagersLogServicesEventLogActionsClearPost( asyncResp); } inline void requestRoutesSystemsJournalEventLog(App& app) { BMCWEB_ROUTE(app, "/redfish/v1/Systems//LogServices/EventLog/Entries/") .privileges(redfish::privileges::getLogEntryCollection) .methods(boost::beast::http::verb::get)(std::bind_front( handleSystemsLogServiceEventLogLogEntryCollection, std::ref(app))); BMCWEB_ROUTE( app, "/redfish/v1/Systems//LogServices/EventLog/Entries//") .privileges(redfish::privileges::getLogEntry) .methods(boost::beast::http::verb::get)(std::bind_front( handleSystemsLogServiceEventLogEntriesGet, std::ref(app))); BMCWEB_ROUTE( app, "/redfish/v1/Systems//LogServices/EventLog/Actions/LogService.ClearLog/") .privileges(redfish::privileges:: postLogServiceSubOverComputerSystemLogServiceCollection) .methods(boost::beast::http::verb::post)(std::bind_front( handleSystemsLogServicesEventLogActionsClearPost, std::ref(app))); } } // namespace redfish