2014-09-11 11:18:07 -04:00
|
|
|
<?php
|
2016-02-08 09:41:00 -05:00
|
|
|
/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
|
2014-09-11 11:18:07 -04:00
|
|
|
|
|
|
|
|
namespace Icinga\Module\Monitoring\Command\Object;
|
|
|
|
|
|
2015-05-07 08:03:09 -04:00
|
|
|
use Icinga\Module\Monitoring\Command\IcingaCommand;
|
|
|
|
|
|
2014-09-11 11:18:07 -04:00
|
|
|
/**
|
|
|
|
|
* Delete a host or service comment
|
|
|
|
|
*/
|
2015-05-07 08:03:09 -04:00
|
|
|
class DeleteCommentCommand extends IcingaCommand
|
2014-09-11 11:18:07 -04:00
|
|
|
{
|
2020-05-14 07:54:04 -04:00
|
|
|
use CommandAuthor;
|
|
|
|
|
|
2014-09-11 11:18:07 -04:00
|
|
|
/**
|
|
|
|
|
* ID of the comment that is to be deleted
|
|
|
|
|
*
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
|
|
|
|
protected $commentId;
|
|
|
|
|
|
2016-08-31 07:00:39 -04:00
|
|
|
/**
|
|
|
|
|
* Name of the comment (Icinga 2.4+)
|
|
|
|
|
*
|
|
|
|
|
* Required for removing the comment via Icinga 2's API.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $commentName;
|
|
|
|
|
|
2015-05-07 08:03:09 -04:00
|
|
|
/**
|
2015-08-21 04:33:18 -04:00
|
|
|
* Whether the command affects a service comment
|
2015-05-07 08:03:09 -04:00
|
|
|
*
|
|
|
|
|
* @var boolean
|
|
|
|
|
*/
|
|
|
|
|
protected $isService = false;
|
|
|
|
|
|
2015-08-21 04:33:18 -04:00
|
|
|
/**
|
|
|
|
|
* Get the ID of the comment that is to be deleted
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getCommentId()
|
|
|
|
|
{
|
|
|
|
|
return $this->commentId;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-11 11:18:07 -04:00
|
|
|
/**
|
|
|
|
|
* Set the ID of the comment that is to be deleted
|
|
|
|
|
*
|
|
|
|
|
* @param int $commentId
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
*/
|
|
|
|
|
public function setCommentId($commentId)
|
|
|
|
|
{
|
|
|
|
|
$this->commentId = (int) $commentId;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-31 07:00:39 -04:00
|
|
|
/**
|
|
|
|
|
* Get the name of the comment (Icinga 2.4+)
|
|
|
|
|
*
|
|
|
|
|
* Required for removing the comment via Icinga 2's API.
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getCommentName()
|
|
|
|
|
{
|
|
|
|
|
return $this->commentName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the name of the comment (Icinga 2.4+)
|
|
|
|
|
*
|
|
|
|
|
* Required for removing the comment via Icinga 2's API.
|
|
|
|
|
*
|
|
|
|
|
* @param string $commentName
|
|
|
|
|
*
|
|
|
|
|
* @return $this
|
|
|
|
|
*/
|
|
|
|
|
public function setCommentName($commentName)
|
|
|
|
|
{
|
|
|
|
|
$this->commentName = $commentName;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-11 11:18:07 -04:00
|
|
|
/**
|
2015-08-21 04:33:18 -04:00
|
|
|
* Get whether the command affects a service comment
|
2015-05-07 08:03:09 -04:00
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function getIsService()
|
|
|
|
|
{
|
|
|
|
|
return $this->isService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-08-21 04:33:18 -04:00
|
|
|
* Set whether the command affects a service comment
|
2015-05-07 08:03:09 -04:00
|
|
|
*
|
2015-07-28 07:32:45 -04:00
|
|
|
* @param bool $isService
|
2015-05-07 08:03:09 -04:00
|
|
|
*
|
2015-07-28 07:32:45 -04:00
|
|
|
* @return $this
|
2015-05-07 08:03:09 -04:00
|
|
|
*/
|
2015-07-28 07:32:45 -04:00
|
|
|
public function setIsService($isService = true)
|
2015-05-07 08:03:09 -04:00
|
|
|
{
|
2015-07-28 07:32:45 -04:00
|
|
|
$this->isService = (bool) $isService;
|
2015-05-07 08:03:09 -04:00
|
|
|
return $this;
|
|
|
|
|
}
|
2014-09-11 11:18:07 -04:00
|
|
|
}
|