| 199 | } |
| 200 | |
| 201 | Dictionary::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 | |
| 222 | Dictionary::Ptr ApiActions::AcknowledgeProblem( |
| 223 | const ConfigObject::Ptr& object, |
nothing calls this directly
no test coverage detected