MCPcopy Create free account
hub / github.com/Icinga/icinga2 / DelayNotification

Method DelayNotification

lib/icinga/apiactions.cpp:201–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201Dictionary::Ptr ApiActions::DelayNotification(
202 const ConfigObject::Ptr& object,
203 const ApiUser::Ptr&,
204 const Dictionary::Ptr& params
205)
206{
207 Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
208
209 if (!checkable)
210 return ApiActions::CreateResult(404, "Cannot delay notifications for non-existent object");
211
212 if (!params->Contains("timestamp"))
213 return ApiActions::CreateResult(400, "A timestamp is required to delay notifications");
214
215 for (const Notification::Ptr& notification : checkable->GetNotifications()) {
216 notification->SetNextNotification(HttpUtility::GetLastParameter(params, "timestamp"));
217 }
218
219 return ApiActions::CreateResult(200, "Successfully delayed notifications for object '" + checkable->GetName() + "'.");
220}
221
222Dictionary::Ptr ApiActions::AcknowledgeProblem(
223 const ConfigObject::Ptr& object,

Callers

nothing calls this directly

Calls 3

ContainsMethod · 0.45
GetNotificationsMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected