2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-02-27 11:05:55 +01:00
|
|
|
|
|
|
|
#ifndef DEPENDENCY_H
|
|
|
|
#define DEPENDENCY_H
|
|
|
|
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "icinga/i2-icinga.hpp"
|
2018-01-18 13:50:38 +01:00
|
|
|
#include "icinga/dependency-ti.hpp"
|
2014-02-27 11:05:55 +01:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2014-05-11 17:14:35 +02:00
|
|
|
class ApplyRule;
|
2014-12-12 15:33:02 +01:00
|
|
|
struct ScriptFrame;
|
2014-11-16 16:20:39 +01:00
|
|
|
class Host;
|
|
|
|
class Service;
|
2014-05-11 17:14:35 +02:00
|
|
|
|
2014-02-27 11:05:55 +01:00
|
|
|
/**
|
|
|
|
* A service dependency..
|
|
|
|
*
|
|
|
|
* @ingroup icinga
|
|
|
|
*/
|
2018-01-04 06:11:04 +01:00
|
|
|
class Dependency final : public ObjectImpl<Dependency>
|
2014-02-27 11:05:55 +01:00
|
|
|
{
|
|
|
|
public:
|
2014-11-03 00:44:04 +01:00
|
|
|
DECLARE_OBJECT(Dependency);
|
|
|
|
DECLARE_OBJECTNAME(Dependency);
|
2014-02-27 11:05:55 +01:00
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
intrusive_ptr<Checkable> GetParent() const;
|
|
|
|
intrusive_ptr<Checkable> GetChild() const;
|
2014-02-27 11:05:55 +01:00
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
TimePeriod::Ptr GetPeriod() const;
|
2014-02-27 11:05:55 +01:00
|
|
|
|
|
|
|
bool IsAvailable(DependencyType dt) const;
|
|
|
|
|
2018-01-11 07:08:09 +01:00
|
|
|
void ValidateStates(const Lazy<Array::Ptr>& lvalue, const ValidationUtils& utils) override;
|
2014-04-07 13:59:41 +02:00
|
|
|
|
2014-11-16 16:20:39 +01:00
|
|
|
static void EvaluateApplyRules(const intrusive_ptr<Host>& host);
|
|
|
|
static void EvaluateApplyRules(const intrusive_ptr<Service>& service);
|
|
|
|
|
2014-02-27 11:05:55 +01:00
|
|
|
protected:
|
2018-01-04 05:12:56 +01:00
|
|
|
void OnConfigLoaded() override;
|
|
|
|
void OnAllConfigLoaded() override;
|
|
|
|
void Stop(bool runtimeRemoved) override;
|
2014-04-05 12:56:56 +02:00
|
|
|
|
|
|
|
private:
|
2014-06-24 11:46:53 +02:00
|
|
|
Checkable::Ptr m_Parent;
|
|
|
|
Checkable::Ptr m_Child;
|
|
|
|
|
2015-01-29 12:38:25 +01:00
|
|
|
static bool EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule);
|
2014-11-16 16:20:39 +01:00
|
|
|
static bool EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule);
|
2014-02-27 11:05:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* DEPENDENCY_H */
|