ImportExport: add ServiceSets

This commit is contained in:
Thomas Gelf 2018-10-06 17:09:43 +02:00
parent 6adc0f7632
commit 9508cf8acd
1 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,7 @@ use Icinga\Module\Director\Objects\DirectorDatalist;
use Icinga\Module\Director\Objects\DirectorJob; use Icinga\Module\Director\Objects\DirectorJob;
use Icinga\Module\Director\Objects\IcingaHostGroup; use Icinga\Module\Director\Objects\IcingaHostGroup;
use Icinga\Module\Director\Objects\IcingaServiceGroup; use Icinga\Module\Director\Objects\IcingaServiceGroup;
use Icinga\Module\Director\Objects\IcingaServiceSet;
use Icinga\Module\Director\Objects\IcingaTemplateChoiceHost; use Icinga\Module\Director\Objects\IcingaTemplateChoiceHost;
use Icinga\Module\Director\Objects\ImportSource; use Icinga\Module\Director\Objects\ImportSource;
use Icinga\Module\Director\Objects\SyncRule; use Icinga\Module\Director\Objects\SyncRule;
@ -21,6 +22,21 @@ class ImportExport
$this->connection = $connection; $this->connection = $connection;
} }
public function serializeAllServiceSets()
{
// TODO: Export host templates in Inheritance order
$res = [];
$related = [];
foreach (IcingaServiceSet::loadAll($this->connection) as $object) {
$res[] = $object->export();
foreach ($object->exportRelated() as $key => $relatedObject) {
$related[$key] = $relatedObject;
}
}
return $res;
}
public function serializeAllHostTemplateChoices() public function serializeAllHostTemplateChoices()
{ {
$res = []; $res = [];