Rest service root implementation
This commit introduces the following
=> Service root implementation
=> compiler option for the IBM management console specific functionalities
TestedBy:
curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/ibm/v1
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Change-Id: I2dcb8eee0b69b1723e0cc3d980a5846b3519e7d9
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
new file mode 100644
index 0000000..01771b3
--- /dev/null
+++ b/include/ibm/management_console_rest.hpp
@@ -0,0 +1,34 @@
+#pragma once
+#include <app.h>
+#include <tinyxml2.h>
+
+#include <async_resp.hpp>
+
+namespace crow
+{
+namespace ibm_mc
+{
+
+template <typename... Middlewares> void requestRoutes(Crow<Middlewares...> &app)
+{
+
+ // allowed only for admin
+ BMCWEB_ROUTE(app, "/ibm/v1/")
+ .requires({"ConfigureComponents", "ConfigureManager"})
+ .methods("GET"_method)(
+ [](const crow::Request &req, crow::Response &res) {
+ res.jsonValue["@odata.type"] =
+ "#ibmServiceRoot.v1_0_0.ibmServiceRoot";
+ res.jsonValue["@odata.id"] = "/ibm/v1/";
+ res.jsonValue["Id"] = "IBM Rest RootService";
+ res.jsonValue["Name"] = "IBM Service Root";
+ res.jsonValue["ConfigFiles"] = {
+ {"@odata.id", "/ibm/v1/Host/ConfigFiles"}};
+ res.jsonValue["LockService"] = {
+ {"@odata.id", "/ibm/v1/HMC/LockService"}};
+ res.end();
+ });
+}
+
+} // namespace ibm_mc
+} // namespace crow