mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 18:20:23 +00:00
Add new "update" API class with the first "checkupdates" action for
testing. We will add an API call for doc'ing once we troubleshoot some issues
This commit is contained in:
@@ -10,8 +10,9 @@
|
||||
|
||||
//sysadm library interface classes
|
||||
#include "sysadm-general.h"
|
||||
#include "sysadm-network.h"
|
||||
#include "sysadm-lifepreserver.h"
|
||||
#include "sysadm-network.h"
|
||||
#include "sysadm-update.h"
|
||||
|
||||
#include "syscache-client.h"
|
||||
#include "dispatcher-client.h"
|
||||
@@ -66,6 +67,8 @@ RestOutputStruct::ExitCode WebSocket::EvaluateBackendRequest(const RestInputStru
|
||||
return EvaluateSysadmNetworkRequest(IN.args, out);
|
||||
}else if(namesp=="sysadm" && name=="lifepreserver"){
|
||||
return EvaluateSysadmLifePreserverRequest(IN.args, out);
|
||||
}else if(namesp=="sysadm" && name=="update"){
|
||||
return EvaluateSysadmUpdateRequest(IN.args, out);
|
||||
}else{
|
||||
return RestOutputStruct::BADREQUEST;
|
||||
}
|
||||
@@ -241,3 +244,27 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmLifePreserverRequest(const Q
|
||||
}
|
||||
return RestOutputStruct::OK;
|
||||
}
|
||||
|
||||
//==== SYSADM -- Update ====
|
||||
RestOutputStruct::ExitCode WebSocket::EvaluateSysadmUpdateRequest(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=="checkupdates"){
|
||||
ok = true;
|
||||
out->insert("checkupdates", sysadm::Update::checkUpdates());
|
||||
}
|
||||
|
||||
} //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