mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-03-21 21:44:51 +00:00
Add LifePreserver API first list-cron call
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
//sysadm library interface classes
|
||||
#include "sysadm-general.h"
|
||||
#include "sysadm-network.h"
|
||||
#include "sysadm-lifepreserver.h"
|
||||
|
||||
#include "syscache-client.h"
|
||||
#include "dispatcher-client.h"
|
||||
@@ -30,6 +31,8 @@ RestOutputStruct::ExitCode WebSocket::EvaluateBackendRequest(QString namesp, QSt
|
||||
return EvaluateSyscacheRequest(args, out);
|
||||
}else if(namesp=="sysadm" && name=="network"){
|
||||
return EvaluateSysadmNetworkRequest(args, out);
|
||||
}else if(namesp=="sysadm" && name=="lifepreserver"){
|
||||
return EvaluateSysadmLifePreserverRequest(args, out);
|
||||
}else{
|
||||
return RestOutputStruct::BADREQUEST;
|
||||
}
|
||||
@@ -130,3 +133,27 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmNetworkRequest(const QJsonVa
|
||||
}
|
||||
return RestOutputStruct::OK;
|
||||
}
|
||||
|
||||
//==== SYSADM -- LifePreserver ====
|
||||
RestOutputStruct::ExitCode WebSocket::EvaluateSysadmLifePreserverRequest(const QJsonValue in_args, QJsonObject *out){
|
||||
if(in_args.isObject()){
|
||||
QStringList keys = in_args.toObject().keys();
|
||||
bool ok = false;
|
||||
if(keys.contains("action")){
|
||||
QString act = JsonValueToString(in_args.toObject().value("action"));
|
||||
if(act=="listcron"){
|
||||
ok = true;
|
||||
out->insert("listcron", sysadm::LifePreserver::listCron());
|
||||
}
|
||||
|
||||
} //end of "action" key usage
|
||||
|
||||
//If nothing done - return the proper code
|
||||
if(!ok){
|
||||
return RestOutputStruct::BADREQUEST;
|
||||
}
|
||||
}else{ // if(in_args.isArray()){
|
||||
return RestOutputStruct::BADREQUEST;
|
||||
}
|
||||
return RestOutputStruct::OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user