2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2015-06-17 15:45:45 +02:00
|
|
|
|
|
|
|
#include "db_ido/zonedbobject.hpp"
|
|
|
|
#include "db_ido/dbtype.hpp"
|
|
|
|
#include "db_ido/dbvalue.hpp"
|
|
|
|
#include "base/logger.hpp"
|
|
|
|
|
|
|
|
using namespace icinga;
|
|
|
|
|
|
|
|
|
|
|
|
REGISTER_DBTYPE(Zone, "zone", DbObjectTypeZone, "zone_object_id", ZoneDbObject);
|
|
|
|
|
|
|
|
ZoneDbObject::ZoneDbObject(const DbType::Ptr& type, const String& name1, const String& name2)
|
|
|
|
: DbObject(type, name1, name2)
|
|
|
|
{ }
|
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
Dictionary::Ptr ZoneDbObject::GetConfigFields() const
|
2015-06-17 15:45:45 +02:00
|
|
|
{
|
|
|
|
Zone::Ptr zone = static_pointer_cast<Zone>(GetObject());
|
|
|
|
|
2018-01-11 11:17:38 +01:00
|
|
|
return new Dictionary({
|
|
|
|
{ "is_global", zone->IsGlobal() ? 1 : 0 },
|
|
|
|
{ "parent_zone_object_id", zone->GetParent() }
|
2015-06-17 15:45:45 +02:00
|
|
|
|
2018-01-11 11:17:38 +01:00
|
|
|
});
|
2015-06-17 15:45:45 +02:00
|
|
|
}
|
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
Dictionary::Ptr ZoneDbObject::GetStatusFields() const
|
2015-06-17 15:45:45 +02:00
|
|
|
{
|
|
|
|
Zone::Ptr zone = static_pointer_cast<Zone>(GetObject());
|
|
|
|
|
|
|
|
Log(LogDebug, "ZoneDbObject")
|
2017-12-19 15:50:05 +01:00
|
|
|
<< "update status for zone '" << zone->GetName() << "'";
|
2015-06-17 15:45:45 +02:00
|
|
|
|
2018-01-11 11:17:38 +01:00
|
|
|
return new Dictionary({
|
|
|
|
{ "parent_zone_object_id", zone->GetParent() }
|
|
|
|
});
|
2015-06-17 15:45:45 +02:00
|
|
|
}
|