--- /dev/null
+#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);
+}
+
--- /dev/null
+#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 */
--- /dev/null
+#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);
+}
+
--- /dev/null
+#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 */