mirror of https://github.com/Icinga/icinga2.git
Added missing files.
This commit is contained in:
parent
e2c04f604f
commit
26396f9e7b
|
@ -0,0 +1,43 @@
|
|||
#include "i2-icinga.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
string HostGroup::GetAlias(void) const
|
||||
{
|
||||
string value;
|
||||
|
||||
if (GetConfigObject()->GetProperty("alias", &value))
|
||||
return value;
|
||||
|
||||
return GetName();
|
||||
}
|
||||
|
||||
string HostGroup::GetNotesUrl(void) const
|
||||
{
|
||||
string value;
|
||||
GetConfigObject()->GetProperty("notes_url", &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
string HostGroup::GetActionUrl(void) const
|
||||
{
|
||||
string value;
|
||||
GetConfigObject()->GetProperty("action_url", &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
bool HostGroup::Exists(const string& name)
|
||||
{
|
||||
return (ConfigObject::GetObject("hostgroup", name));
|
||||
}
|
||||
|
||||
HostGroup HostGroup::GetByName(const string& name)
|
||||
{
|
||||
ConfigObject::Ptr configObject = ConfigObject::GetObject("hostgroup", name);
|
||||
|
||||
if (!configObject)
|
||||
throw invalid_argument("HostGroup '" + name + "' does not exist.");
|
||||
|
||||
return HostGroup(configObject);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef HOSTGROUP_H
|
||||
#define HOSTGROUP_H
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
||||
class I2_ICINGA_API HostGroup : public ConfigObjectAdapter
|
||||
{
|
||||
public:
|
||||
HostGroup(const ConfigObject::Ptr& configObject)
|
||||
: ConfigObjectAdapter(configObject)
|
||||
{ }
|
||||
|
||||
static bool Exists(const string& name);
|
||||
static HostGroup GetByName(const string& name);
|
||||
|
||||
string GetAlias(void) const;
|
||||
string GetNotesUrl(void) const;
|
||||
string GetActionUrl(void) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* HOSTGROUP_H */
|
|
@ -0,0 +1,43 @@
|
|||
#include "i2-icinga.h"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
string ServiceGroup::GetAlias(void) const
|
||||
{
|
||||
string value;
|
||||
|
||||
if (GetConfigObject()->GetProperty("alias", &value))
|
||||
return value;
|
||||
|
||||
return GetName();
|
||||
}
|
||||
|
||||
string ServiceGroup::GetNotesUrl(void) const
|
||||
{
|
||||
string value;
|
||||
GetConfigObject()->GetProperty("notes_url", &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
string ServiceGroup::GetActionUrl(void) const
|
||||
{
|
||||
string value;
|
||||
GetConfigObject()->GetProperty("action_url", &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
bool ServiceGroup::Exists(const string& name)
|
||||
{
|
||||
return (ConfigObject::GetObject("hostgroup", name));
|
||||
}
|
||||
|
||||
ServiceGroup ServiceGroup::GetByName(const string& name)
|
||||
{
|
||||
ConfigObject::Ptr configObject = ConfigObject::GetObject("hostgroup", name);
|
||||
|
||||
if (!configObject)
|
||||
throw invalid_argument("ServiceGroup '" + name + "' does not exist.");
|
||||
|
||||
return ServiceGroup(configObject);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef SERVICEGROUP_H
|
||||
#define SERVICEGROUP_H
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
||||
class I2_ICINGA_API ServiceGroup : public ConfigObjectAdapter
|
||||
{
|
||||
public:
|
||||
ServiceGroup(const ConfigObject::Ptr& configObject)
|
||||
: ConfigObjectAdapter(configObject)
|
||||
{ }
|
||||
|
||||
static bool Exists(const string& name);
|
||||
static ServiceGroup GetByName(const string& name);
|
||||
|
||||
string GetAlias(void) const;
|
||||
string GetNotesUrl(void) const;
|
||||
string GetActionUrl(void) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SERVICEGROUP_H */
|
Loading…
Reference in New Issue