summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/library/Monitoring/Command/Object/SendCustomNotificationCommand.php
blob: ac8889cf24e56eec4a9f83ef060717649b20c107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Monitoring\Command\Object;

/**
 * Send custom notifications for a host or service
 */
class SendCustomNotificationCommand extends WithCommentCommand
{
    /**
     * {@inheritdoc}
     */
    protected $allowedObjects = array(
        self::TYPE_HOST,
        self::TYPE_SERVICE
    );

    /**
     * Whether the notification is forced
     *
     * Forced notifications are sent out regardless of time restrictions and whether or not notifications are enabled.
     *
     * @var bool
     */
    protected $forced;

    /**
     * Whether to broadcast the notification
     *
     * Broadcast notifications are sent out to all normal and escalated contacts.
     *
     * @var bool
     */
    protected $broadcast;

    /**
     * Get whether to force the notification
     *
     * @return bool
     */
    public function getForced()
    {
        return $this->forced;
    }

    /**
     * Set whether to force the notification
     *
     * @param   bool $forced
     *
     * @return  $this
     */
    public function setForced($forced = true)
    {
        $this->forced = $forced;
        return $this;
    }

    /**
     * Get whether to broadcast the notification
     *
     * @return bool
     */
    public function getBroadcast()
    {
        return $this->broadcast;
    }

    /**
     * Set whether to broadcast the notification
     *
     * @param   bool $broadcast
     *
     * @return  $this
     */
    public function setBroadcast($broadcast = true)
    {
        $this->broadcast = $broadcast;
        return $this;
    }
}