mirror of https://github.com/Icinga/icinga2.git
Merge pull request #6531 from Icinga/feature/zone-all_parents
Expose Zone#all_parents via API
This commit is contained in:
commit
f1e7e635a2
|
@ -1003,7 +1003,7 @@ void ApiListener::SyncRelayMessage(const MessageOrigin::Ptr& origin,
|
|||
|
||||
bool need_log = !RelayMessageOne(target_zone, origin, message, master);
|
||||
|
||||
for (const Zone::Ptr& zone : target_zone->GetAllParents()) {
|
||||
for (const Zone::Ptr& zone : target_zone->GetAllParentsRaw()) {
|
||||
if (!RelayMessageOne(zone, origin, message, master))
|
||||
need_log = true;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "remote/zone.hpp"
|
||||
#include "remote/zone-ti.cpp"
|
||||
#include "remote/jsonrpcconnection.hpp"
|
||||
#include "base/array.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
||||
|
@ -89,11 +90,21 @@ std::set<Endpoint::Ptr> Zone::GetEndpoints() const
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<Zone::Ptr> Zone::GetAllParents() const
|
||||
std::vector<Zone::Ptr> Zone::GetAllParentsRaw() const
|
||||
{
|
||||
return m_AllParents;
|
||||
}
|
||||
|
||||
Array::Ptr Zone::GetAllParents() const
|
||||
{
|
||||
auto result (new Array);
|
||||
|
||||
for (auto& parent : m_AllParents)
|
||||
result->Add(parent->GetName());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Zone::CanAccessObject(const ConfigObject::Ptr& object)
|
||||
{
|
||||
Zone::Ptr object_zone;
|
||||
|
|
|
@ -40,7 +40,8 @@ public:
|
|||
|
||||
Zone::Ptr GetParent() const;
|
||||
std::set<Endpoint::Ptr> GetEndpoints() const;
|
||||
std::vector<Zone::Ptr> GetAllParents() const;
|
||||
std::vector<Zone::Ptr> GetAllParentsRaw() const;
|
||||
Array::Ptr GetAllParents() const override;
|
||||
|
||||
bool CanAccessObject(const ConfigObject::Ptr& object);
|
||||
bool IsChildOf(const Zone::Ptr& zone);
|
||||
|
|
|
@ -34,6 +34,9 @@ class Zone : ConfigObject
|
|||
|
||||
[config] array(name(Endpoint)) endpoints (EndpointsRaw);
|
||||
[config] bool global;
|
||||
[no_user_modify, no_storage] array(Value) all_parents {
|
||||
get;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue