Implement lock service introspect
This will list down the actions implemented by the
Lock Service.
TestedBy:
curl -k -H "X-Auth-Token: $bmc_tokens" -X GET https://<ip>:443/ibm/v1/HMC/LockService
{
"Actions": {
"#LockService.AcquireLock": {
"target": "/ibm/v1/HMC/LockService/Actions/LockService.AcquireLock"
},
"#LockService.GetLockList": {
"target": "/ibm/v1/HMC/LockService/Actions/LockService.GetLockList"
},
"#LockService.ReleaseLock": {
"target": "/ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock"
}
}
}
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Change-Id: Ifeb53c06c4ff80676c892f1e64518469a3aeb239
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 70c757a..225861d 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -161,6 +161,22 @@
res.end();
}
+void getLockServiceData(crow::Response &res)
+{
+ res.jsonValue["@odata.type"] = "#LockService.v1_0_0.LockService";
+ res.jsonValue["@odata.id"] = "/ibm/v1/HMC/LockService/";
+ res.jsonValue["Id"] = "LockService";
+ res.jsonValue["Name"] = "LockService";
+
+ res.jsonValue["Actions"]["#LockService.AcquireLock"] = {
+ {"target", "/ibm/v1/HMC/LockService/Actions/LockService.AcquireLock"}};
+ res.jsonValue["Actions"]["#LockService.ReleaseLock"] = {
+ {"target", "/ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock"}};
+ res.jsonValue["Actions"]["#LockService.GetLockList"] = {
+ {"target", "/ibm/v1/HMC/LockService/Actions/LockService.GetLockList"}};
+ res.end();
+}
+
void handleFileGet(crow::Response &res, const std::string &fileID)
{
BMCWEB_LOG_DEBUG << "HandleGet on SaveArea files on path: " << fileID;
@@ -283,6 +299,13 @@
.methods("PUT"_method, "GET"_method, "DELETE"_method)(
[](const crow::Request &req, crow::Response &res,
const std::string &path) { handleFileUrl(req, res, path); });
+
+ BMCWEB_ROUTE(app, "/ibm/v1/HMC/LockService")
+ .requires({"ConfigureComponents", "ConfigureManager"})
+ .methods("GET"_method)(
+ [](const crow::Request &req, crow::Response &res) {
+ getLockServiceData(res);
+ });
}
} // namespace ibm_mc