2014-09-11 17:18:07 +02:00
|
|
|
<?php
|
2016-02-08 15:41:00 +01:00
|
|
|
/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
2014-09-11 17:18:07 +02:00
|
|
|
|
|
|
|
namespace Icinga\Module\Monitoring\Command\Object;
|
|
|
|
|
2015-04-27 18:04:10 +02:00
|
|
|
use Icinga\Module\Monitoring\Command\IcingaCommand;
|
|
|
|
|
2014-09-11 17:18:07 +02:00
|
|
|
/**
|
|
|
|
* Delete a host or service downtime
|
|
|
|
*/
|
2015-04-27 18:04:10 +02:00
|
|
|
class DeleteDowntimeCommand extends IcingaCommand
|
2014-09-11 17:18:07 +02:00
|
|
|
{
|
2020-05-14 13:58:03 +02:00
|
|
|
use CommandAuthor;
|
|
|
|
|
2014-09-11 17:18:07 +02:00
|
|
|
/**
|
|
|
|
* ID of the downtime that is to be deleted
|
|
|
|
*
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
protected $downtimeId;
|
2015-05-07 14:05:16 +02:00
|
|
|
|
2016-08-31 13:01:19 +02:00
|
|
|
/**
|
|
|
|
* Name of the downtime (Icinga 2.4+)
|
|
|
|
*
|
|
|
|
* Required for removing the downtime via Icinga 2's API.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $downtimeName;
|
|
|
|
|
2015-04-27 18:04:10 +02:00
|
|
|
/**
|
2015-08-21 10:30:41 +02:00
|
|
|
* Whether the command affects a service downtime
|
2015-04-27 18:04:10 +02:00
|
|
|
*
|
2015-05-07 14:05:16 +02:00
|
|
|
* @var boolean
|
2015-04-27 18:04:10 +02:00
|
|
|
*/
|
2015-05-07 14:05:16 +02:00
|
|
|
protected $isService = false;
|
|
|
|
|
2015-04-27 18:04:10 +02:00
|
|
|
/**
|
2015-08-21 10:30:41 +02:00
|
|
|
* Get the ID of the downtime that is to be deleted
|
2015-04-27 18:04:10 +02:00
|
|
|
*
|
2015-08-21 10:30:41 +02:00
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getDowntimeId()
|
|
|
|
{
|
|
|
|
return $this->downtimeId;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the ID of the downtime that is to be deleted
|
|
|
|
*
|
|
|
|
* @param int $downtimeId
|
2015-07-28 13:33:07 +02:00
|
|
|
*
|
|
|
|
* @return $this
|
2015-04-27 18:04:10 +02:00
|
|
|
*/
|
2015-08-21 10:30:41 +02:00
|
|
|
public function setDowntimeId($downtimeId)
|
2015-04-27 18:04:10 +02:00
|
|
|
{
|
2015-08-21 10:30:41 +02:00
|
|
|
$this->downtimeId = (int) $downtimeId;
|
2015-07-28 13:33:07 +02:00
|
|
|
return $this;
|
2015-04-27 18:04:10 +02:00
|
|
|
}
|
2015-07-28 13:33:07 +02:00
|
|
|
|
2016-08-31 13:01:19 +02:00
|
|
|
/**
|
|
|
|
* Get the name of the downtime (Icinga 2.4+)
|
|
|
|
*
|
|
|
|
* Required for removing the downtime via Icinga 2's API.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getDowntimeName()
|
|
|
|
{
|
|
|
|
return $this->downtimeName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the name of the downtime (Icinga 2.4+)
|
|
|
|
*
|
|
|
|
* Required for removing the downtime via Icinga 2's API.
|
|
|
|
*
|
|
|
|
* @param string $downtimeName
|
|
|
|
*
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function setDowntimeName($downtimeName)
|
|
|
|
{
|
|
|
|
$this->downtimeName = $downtimeName;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-04-27 18:04:10 +02:00
|
|
|
/**
|
2015-08-21 10:30:41 +02:00
|
|
|
* Get whether the command affects a service
|
2015-05-07 14:05:16 +02:00
|
|
|
*
|
2015-07-28 13:33:07 +02:00
|
|
|
* @return bool
|
2015-04-27 18:04:10 +02:00
|
|
|
*/
|
2015-05-07 14:05:16 +02:00
|
|
|
public function getIsService()
|
2015-04-27 18:04:10 +02:00
|
|
|
{
|
2015-05-07 14:05:16 +02:00
|
|
|
return $this->isService;
|
2015-04-27 18:04:10 +02:00
|
|
|
}
|
2014-09-11 17:18:07 +02:00
|
|
|
|
|
|
|
/**
|
2015-08-21 10:30:41 +02:00
|
|
|
* Set whether the command affects a service
|
2014-09-11 17:18:07 +02:00
|
|
|
*
|
2015-08-21 10:30:41 +02:00
|
|
|
* @param bool $isService
|
2014-09-11 17:18:07 +02:00
|
|
|
*
|
|
|
|
* @return $this
|
|
|
|
*/
|
2015-08-21 10:30:41 +02:00
|
|
|
public function setIsService($isService = true)
|
2014-09-11 17:18:07 +02:00
|
|
|
{
|
2015-08-21 10:30:41 +02:00
|
|
|
$this->isService = (bool) $isService;
|
2014-09-11 17:18:07 +02:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|