line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Zabbix2::API::Template; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
119
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
140
|
|
5
|
3
|
|
|
3
|
|
77
|
use 5.010; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
105
|
|
6
|
3
|
|
|
3
|
|
22
|
use Carp; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
191
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
17
|
use Moo; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
16
|
|
9
|
|
|
|
|
|
|
extends qw/Zabbix2::API::CRUDE/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'items' => (is => 'ro', |
12
|
|
|
|
|
|
|
lazy => 1, |
13
|
|
|
|
|
|
|
builder => '_fetch_items'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub id { |
16
|
|
|
|
|
|
|
## mutator for id |
17
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
18
|
0
|
0
|
|
|
|
|
if (defined $value) { |
19
|
0
|
|
|
|
|
|
$self->data->{templateid} = $value; |
20
|
0
|
|
|
|
|
|
return $self->data->{templateid}; |
21
|
|
|
|
|
|
|
} else { |
22
|
0
|
|
|
|
|
|
return $self->data->{templateid}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _prefix { |
27
|
0
|
|
|
0
|
|
|
my (undef, $suffix) = @_; |
28
|
0
|
0
|
|
|
|
|
if ($suffix) { |
29
|
0
|
|
|
|
|
|
return 'template'.$suffix; |
30
|
|
|
|
|
|
|
} else { |
31
|
0
|
|
|
|
|
|
return 'template'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _extension { |
36
|
0
|
|
|
0
|
|
|
return (output => 'extend'); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub name { |
40
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
41
|
0
|
|
0
|
|
|
|
return $self->data->{host} || ''; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _fetch_items { |
45
|
0
|
|
|
0
|
|
|
my $self = shift; |
46
|
0
|
|
|
|
|
|
my $items = $self->{root}->fetch('Item', params => { templateids => [ $self->data->{templateid} ] }); |
47
|
0
|
|
|
|
|
|
return $items; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
__END__ |