1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "base/configobject.hpp"
4 #include "base/utility.hpp"
5 #impl_include "icinga/service.hpp"
13 class DowntimeNameComposer : public NameComposer
16 virtual String MakeName(const String& shortName, const Object::Ptr& context) const;
17 virtual Dictionary::Ptr ParseName(const String& name) const;
21 class Downtime : ConfigObject < DowntimeNameComposer
23 activation_priority -10;
28 [config, protected, required, navigation(host)] name(Host) host_name {
30 return Host::GetByName(GetHostName());
33 [config, protected, navigation(service)] String service_name {
35 if (!oldValue.IsEmpty()) {
36 Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
37 DependencyGraph::RemoveDependency(this, service.get());
40 if (!newValue.IsEmpty()) {
41 Service::Ptr service = Service::GetByNamePair(GetHostName(), newValue);
42 DependencyGraph::AddDependency(this, service.get());
46 if (GetServiceName().IsEmpty())
49 Host::Ptr host = Host::GetByName(GetHostName());
50 return host->GetServiceByShortName(GetServiceName());
54 [config] Timestamp entry_time {
55 default {{{ return Utility::GetTime(); }}}
57 [config, required] String author;
58 [config, required] String comment;
59 [config] Timestamp start_time;
60 [config] Timestamp end_time;
61 [state] Timestamp trigger_time;
63 [config] Timestamp duration;
64 [config] String triggered_by;
65 [config] String scheduled_by;
66 [state] Array::Ptr triggers {
67 default {{{ return new Array(); }}}
69 [state] int legacy_id;
70 [state] bool was_cancelled;
71 [config] String config_owner;
72 [config] String authoritative_zone;