IcingaObject, Host/Service: add supportsChoices()

This commit is contained in:
Thomas Gelf 2017-06-28 08:47:14 +02:00
parent 6ca1ec2951
commit a9a2295c8a
3 changed files with 19 additions and 0 deletions

View File

@ -85,6 +85,8 @@ class IcingaHost extends IcingaObject
protected $supportsFields = true;
protected $supportsChoices = true;
protected $supportedInLegacy = true;
/** @var HostGroupMembershipResolver */

View File

@ -51,6 +51,9 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
/** @var bool Whether Sets of object can be defined */
protected $supportsSets = false;
/** @var bool Whether this Object supports template-based Choices */
protected $supportsChoices = false;
/** @var bool If the object is rendered in legacy config */
protected $supportedInLegacy = false;
@ -427,6 +430,16 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
return $this->supportsSets;
}
/**
* Whether this object supports template-based Choices
*
* @return bool
*/
public function supportsChoices()
{
return $this->supportsChoices;
}
public function setAssignments($value)
{
return IcingaObjectLegacyAssignments::applyToObject($this, $value);

View File

@ -47,6 +47,7 @@ class IcingaService extends IcingaObject
'apply_for' => null,
'use_var_overrides' => null,
'assign_filter' => null,
'template_choice_id' => null,
);
protected $relations = array(
@ -57,6 +58,7 @@ class IcingaService extends IcingaObject
'check_period' => 'IcingaTimePeriod',
'command_endpoint' => 'IcingaEndpoint',
'zone' => 'IcingaZone',
'template_choice' => 'IcingaTemplateChoiceService',
);
protected $booleans = array(
@ -88,6 +90,8 @@ class IcingaService extends IcingaObject
protected $supportsSets = true;
protected $supportsChoices = true;
protected $supportedInLegacy = true;
protected $keyName = array('host_id', 'service_set_id', 'object_name');