mirror of https://github.com/Icinga/icinga2.git
parent
611ff869e1
commit
3227186c7d
|
@ -64,8 +64,8 @@ bool ActionsHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& reques
|
||||||
try {
|
try {
|
||||||
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
HttpUtility::SendJsonError(response, 400,
|
HttpUtility::SendJsonError(response, 404,
|
||||||
"Type/Filter was required but not provided or was invalid.",
|
"No objects found.",
|
||||||
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,16 @@ bool DeleteObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r
|
||||||
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
std::vector<Value> objs;
|
||||||
|
|
||||||
|
try {
|
||||||
|
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
HttpUtility::SendJsonError(response, 404,
|
||||||
|
"No objects found.",
|
||||||
|
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool cascade = HttpUtility::GetLastParameter(params, "cascade");
|
bool cascade = HttpUtility::GetLastParameter(params, "cascade");
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,16 @@ bool ModifyObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r
|
||||||
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
std::vector<Value> objs;
|
||||||
|
|
||||||
|
try {
|
||||||
|
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
HttpUtility::SendJsonError(response, 404,
|
||||||
|
"No objects found.",
|
||||||
|
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary::Ptr attrs = params->Get("attrs");
|
Dictionary::Ptr attrs = params->Get("attrs");
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,16 @@ bool ObjectQueryHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& re
|
||||||
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
params->Set(attr, request.RequestUrl->GetPath()[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
std::vector<Value> objs;
|
||||||
|
|
||||||
|
try {
|
||||||
|
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
HttpUtility::SendJsonError(response, 404,
|
||||||
|
"No objects found.",
|
||||||
|
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Array::Ptr results = new Array();
|
Array::Ptr results = new Array();
|
||||||
results->Reserve(objs.size());
|
results->Reserve(objs.size());
|
||||||
|
|
|
@ -92,7 +92,16 @@ bool StatusHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& request
|
||||||
if (request.RequestUrl->GetPath().size() >= 3)
|
if (request.RequestUrl->GetPath().size() >= 3)
|
||||||
params->Set("status", request.RequestUrl->GetPath()[2]);
|
params->Set("status", request.RequestUrl->GetPath()[2]);
|
||||||
|
|
||||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
std::vector<Value> objs;
|
||||||
|
|
||||||
|
try {
|
||||||
|
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
HttpUtility::SendJsonError(response, 404,
|
||||||
|
"No objects found.",
|
||||||
|
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Array::Ptr results = Array::FromVector(objs);
|
Array::Ptr results = Array::FromVector(objs);
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,16 @@ bool TypeQueryHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& requ
|
||||||
if (request.RequestUrl->GetPath().size() >= 3)
|
if (request.RequestUrl->GetPath().size() >= 3)
|
||||||
params->Set("name", request.RequestUrl->GetPath()[2]);
|
params->Set("name", request.RequestUrl->GetPath()[2]);
|
||||||
|
|
||||||
std::vector<Value> objs = FilterUtility::GetFilterTargets(qd, params, user);
|
std::vector<Value> objs;
|
||||||
|
|
||||||
|
try {
|
||||||
|
objs = FilterUtility::GetFilterTargets(qd, params, user);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
HttpUtility::SendJsonError(response, 404,
|
||||||
|
"No objects found.",
|
||||||
|
HttpUtility::GetLastParameter(params, "verboseErrors") ? DiagnosticInformation(ex) : "");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Array::Ptr results = new Array();
|
Array::Ptr results = new Array();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue