1 /******************************************************************************
3 * Copyright (C) 2012-2018 Icinga Development Team (https://icinga.com/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
20 #include "base/configobject.hpp"
21 #include "base/utility.hpp"
22 #impl_include "icinga/service.hpp"
30 class DowntimeNameComposer : public NameComposer
33 virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
34 virtual Dictionary::Ptr ParseName(const String& name) const;
38 class Downtime : ConfigObject < DowntimeNameComposer
40 activation_priority -10;
45 [config, protected, required, navigation(host)] name(Host) host_name {
47 return Host::GetByName(GetHostName());
50 [config, protected, navigation(service)] String service_name {
52 if (!oldValue.IsEmpty()) {
53 Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
54 DependencyGraph::RemoveDependency(this, service.get());
57 if (!newValue.IsEmpty()) {
58 Service::Ptr service = Service::GetByNamePair(GetHostName(), newValue);
59 DependencyGraph::AddDependency(this, service.get());
63 if (GetServiceName().IsEmpty())
66 Host::Ptr host = Host::GetByName(GetHostName());
67 return host->GetServiceByShortName(GetServiceName());
71 [config] Timestamp entry_time {
72 default {{{ return Utility::GetTime(); }}}
74 [config, required] String author;
75 [config, required] String comment;
76 [config] Timestamp start_time;
77 [config] Timestamp end_time;
78 [state] Timestamp trigger_time;
80 [config] Timestamp duration;
81 [config] String triggered_by;
82 [config] String scheduled_by;
83 [state] Array::Ptr triggers {
84 default {{{ return new Array(); }}}
86 [state] int legacy_id;
87 [state] bool was_cancelled;
88 [config] String config_owner;
89 [config] String authoritative_zone;