Redfish: Query parameters: Only
Add the query parameter "only" for redfish.
The specification is based on DSP0266_1.8.0.
This commit is inspired by the commit that carries the same title, but
is largely unique, namely, in that it adds the core feature to be able
to recall handle with a new Response object, and make sure the result
gets to the connection. It does this by swapping the handlers and
implementing move semantics on the Response object. It definitely needs
broken up into a few smaller patches, but it does pass the below tests
without any apparent seg faults or ownership issues.
It implements a number of cleanups that deserve their own patches, and
will be split up accordingly, but for the moment, I think this is a good
start to getting filter and expand support in the future.
Tested:
Validator passes (on previous patchset)
~$ curl -i -k -H "X-Auth-Token: $token" -X GET "https://${bmc}/redfish/v1/Systems"
~$ curl -i -k -H "X-Auth-Token: $token" -X GET "https://${bmc}/redfish/v1/Systems?only"
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I123d8ab8bcd88a0b63ff131f6b98548951989755
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 429e992..83f9dad 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -19,6 +19,7 @@
#include "health.hpp"
#include "led.hpp"
#include "pcie.hpp"
+#include "query.hpp"
#include "redfish_util.hpp"
#include <app.hpp>
@@ -2652,8 +2653,12 @@
BMCWEB_ROUTE(app, "/redfish/v1/Systems/")
.privileges(redfish::privileges::getComputerSystemCollection)
.methods(boost::beast::http::verb::get)(
- [](const crow::Request& /*req*/,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ [&app](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp->res))
+ {
+ return;
+ }
asyncResp->res.jsonValue["@odata.type"] =
"#ComputerSystemCollection.ComputerSystemCollection";
asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems";