]> granicus.if.org Git - icinga2/blob - lib/db_ido/zonedbobject.cpp
Merge pull request #7185 from Icinga/bugfix/gelfwriter-wrong-log-facility
[icinga2] / lib / db_ido / zonedbobject.cpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #include "db_ido/zonedbobject.hpp"
4 #include "db_ido/dbtype.hpp"
5 #include "db_ido/dbvalue.hpp"
6 #include "base/logger.hpp"
7
8 using namespace icinga;
9
10
11 REGISTER_DBTYPE(Zone, "zone", DbObjectTypeZone, "zone_object_id", ZoneDbObject);
12
13 ZoneDbObject::ZoneDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
14         : DbObject(type, name1, name2)
15 { }
16
17 Dictionary::Ptr ZoneDbObject::GetConfigFields() const
18 {
19         Zone::Ptr zone = static_pointer_cast<Zone>(GetObject());
20
21         return new Dictionary({
22                 { "is_global", zone->IsGlobal() ? 1 : 0 },
23                 { "parent_zone_object_id", zone->GetParent() }
24
25         });
26 }
27
28 Dictionary::Ptr ZoneDbObject::GetStatusFields() const
29 {
30         Zone::Ptr zone = static_pointer_cast<Zone>(GetObject());
31
32         Log(LogDebug, "ZoneDbObject")
33                 << "update status for zone '" << zone->GetName() << "'";
34
35         return new Dictionary({
36                 { "parent_zone_object_id", zone->GetParent() }
37         });
38 }