summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/application/forms/Config/Transport/ApiTransportForm.php
blob: 3d501e0832df3272546953a10aa44c377dad7cb3 (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
<?php
/* Icinga Web 2 | (c) 2016 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Monitoring\Forms\Config\Transport;

use Icinga\Web\Form;

class ApiTransportForm extends Form
{
    /**
     * {@inheritdoc}
     */
    public function init()
    {
        $this->setName('form_config_command_transport_api');
    }

    /**
     * {@inheritdoc}
     */
    public function createElements(array $formData = array())
    {
        $this->addElements(array(
            array(
                'text',
                'host',
                array(
                    'required'      => true,
                    'label'         => $this->translate('Host'),
                    'description'   => $this->translate(
                        'Hostname or address of the remote Icinga instance'
                    )
                )
            ),
            array(
                'number',
                'port',
                array(
                    'required'          => true,
                    'preserveDefault'   => true,
                    'label'             => $this->translate('Port'),
                    'description'       => $this->translate('SSH port to connect to on the remote Icinga instance'),
                    'value'             => 5665
                )
            ),
            array(
                'text',
                'username',
                array(
                    'required'      => true,
                    'label'         => $this->translate('API Username'),
                    'description'   => $this->translate(
                        'User to log in as on the remote Icinga instance. Please note that key-based SSH login must be'
                        . ' possible for this user'
                    )
                )
            ),
            array(
                'password',
                'password',
                array(
                    'required'      => true,
                    'label'         => $this->translate('API Password'),
                    'description'   => $this->translate(
                        'User to log in as on the remote Icinga instance. Please note that key-based SSH login must be'
                        . ' possible for this user'
                    ),
                    'renderPassword'    => true
                )
            )
        ));

        return $this;
    }
}