2019-02-25 08:48:22 -05:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-10-17 13:44:31 -04:00
|
|
|
|
2015-03-28 06:04:42 -04:00
|
|
|
#include "base/debuginfo.hpp"
|
2016-08-16 05:02:10 -04:00
|
|
|
#include "base/configtype.hpp"
|
2015-03-28 06:04:42 -04:00
|
|
|
|
2015-08-04 08:47:44 -04:00
|
|
|
library base;
|
|
|
|
|
|
2013-10-26 03:41:45 -04:00
|
|
|
namespace icinga
|
|
|
|
|
{
|
|
|
|
|
|
2014-04-05 16:17:20 -04:00
|
|
|
code {{{
|
2014-08-13 14:30:28 -04:00
|
|
|
enum HAMode
|
|
|
|
|
{
|
|
|
|
|
HARunOnce,
|
|
|
|
|
HARunEverywhere
|
|
|
|
|
};
|
|
|
|
|
|
2017-12-31 01:22:16 -05:00
|
|
|
class NameComposer
|
2016-08-09 03:00:19 -04:00
|
|
|
{
|
2014-04-05 16:17:20 -04:00
|
|
|
public:
|
2018-01-03 22:25:35 -05:00
|
|
|
virtual ~NameComposer();
|
2016-08-09 03:00:19 -04:00
|
|
|
|
2014-11-06 13:35:47 -05:00
|
|
|
virtual String MakeName(const String& shortName, const Object::Ptr& context) const = 0;
|
2015-08-13 03:02:52 -04:00
|
|
|
virtual Dictionary::Ptr ParseName(const String& name) const = 0;
|
2014-04-05 16:17:20 -04:00
|
|
|
};
|
|
|
|
|
}}}
|
|
|
|
|
|
2015-08-15 14:28:05 -04:00
|
|
|
abstract class ConfigObjectBase
|
2014-11-30 17:32:13 -05:00
|
|
|
{ };
|
|
|
|
|
|
|
|
|
|
code {{{
|
2017-12-31 01:22:16 -05:00
|
|
|
class ConfigObjectBase : public ObjectImpl<ConfigObjectBase>
|
2014-11-30 17:32:13 -05:00
|
|
|
{
|
|
|
|
|
public:
|
2018-01-03 22:25:35 -05:00
|
|
|
inline DebugInfo GetDebugInfo() const
|
2014-11-30 17:32:13 -05:00
|
|
|
{
|
|
|
|
|
return m_DebugInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetDebugInfo(const DebugInfo& di)
|
|
|
|
|
{
|
|
|
|
|
m_DebugInfo = di;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-24 13:59:13 -04:00
|
|
|
inline virtual void Start(bool /* runtimeCreated */)
|
2015-08-25 07:53:43 -04:00
|
|
|
{ }
|
|
|
|
|
|
2016-08-24 13:59:13 -04:00
|
|
|
inline virtual void Stop(bool /* runtimeRemoved */)
|
2015-08-25 07:53:43 -04:00
|
|
|
{ }
|
|
|
|
|
|
2014-11-30 17:32:13 -05:00
|
|
|
private:
|
|
|
|
|
DebugInfo m_DebugInfo;
|
|
|
|
|
};
|
2016-08-16 05:02:10 -04:00
|
|
|
|
2014-11-30 17:32:13 -05:00
|
|
|
}}}
|
|
|
|
|
|
2016-08-16 05:02:10 -04:00
|
|
|
abstract class ConfigObject : ConfigObjectBase < ConfigType
|
2013-10-26 03:41:45 -04:00
|
|
|
{
|
2015-10-20 02:20:35 -04:00
|
|
|
[config, no_user_modify] String __name (Name);
|
2022-06-21 05:12:03 -04:00
|
|
|
[config, no_user_modify, required] String "name" (ShortName) {
|
2014-04-05 03:15:40 -04:00
|
|
|
get {{{
|
2022-05-02 10:40:29 -04:00
|
|
|
String shortName = m_ShortName.load();
|
|
|
|
|
if (shortName.IsEmpty())
|
2014-04-05 03:15:40 -04:00
|
|
|
return GetName();
|
|
|
|
|
else
|
2022-05-02 10:40:29 -04:00
|
|
|
return shortName;
|
2014-04-05 03:15:40 -04:00
|
|
|
}}}
|
|
|
|
|
};
|
2017-04-12 03:25:28 -04:00
|
|
|
[config, no_user_modify] name(Zone) zone (ZoneName);
|
2015-10-20 02:20:35 -04:00
|
|
|
[config, no_user_modify] String package;
|
|
|
|
|
[config, get_protected, no_user_modify] Array::Ptr templates;
|
2017-04-19 09:30:11 -04:00
|
|
|
[config, no_storage, no_user_modify] Dictionary::Ptr source_location {
|
|
|
|
|
get;
|
|
|
|
|
};
|
2015-10-20 02:20:35 -04:00
|
|
|
[get_protected, no_user_modify] bool active;
|
|
|
|
|
[get_protected, no_user_modify] bool paused {
|
2014-05-09 07:02:30 -04:00
|
|
|
default {{{ return true; }}}
|
|
|
|
|
};
|
2015-10-20 02:20:35 -04:00
|
|
|
[get_protected, no_user_view, no_user_modify] bool start_called;
|
|
|
|
|
[get_protected, no_user_view, no_user_modify] bool stop_called;
|
|
|
|
|
[get_protected, no_user_view, no_user_modify] bool pause_called;
|
|
|
|
|
[get_protected, no_user_view, no_user_modify] bool resume_called;
|
2014-08-13 14:30:28 -04:00
|
|
|
[enum] HAMode ha_mode (HAMode);
|
2015-10-20 02:20:35 -04:00
|
|
|
[protected, no_user_view, no_user_modify] Dictionary::Ptr extensions;
|
2014-04-15 11:33:56 -04:00
|
|
|
|
2015-10-20 02:20:35 -04:00
|
|
|
[protected, no_user_view, no_user_modify] bool state_loaded;
|
|
|
|
|
[no_user_modify] Dictionary::Ptr original_attributes;
|
|
|
|
|
[state, no_user_modify] double version {
|
2015-09-30 10:58:18 -04:00
|
|
|
default {{{ return 0; }}}
|
2015-08-20 10:43:03 -04:00
|
|
|
};
|
2022-09-09 07:16:02 -04:00
|
|
|
[no_user_view, no_user_modify] String icingadb_identifier;
|
2013-10-26 03:41:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|