line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter::API::Notification; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
894
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
102
|
|
4
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
47
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use parent 'Net::SecurityCenter::Base'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
19
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
122
|
use Net::SecurityCenter::Utils qw(:all); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1158
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.311'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $common_template = { |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
id => { |
15
|
|
|
|
|
|
|
required => 1, |
16
|
|
|
|
|
|
|
allow => qr/^\d+$/, |
17
|
|
|
|
|
|
|
messages => { |
18
|
|
|
|
|
|
|
required => 'Notification ID is required', |
19
|
|
|
|
|
|
|
allow => 'Invalid Notification ID', |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
fields => { |
24
|
|
|
|
|
|
|
filter => \&sc_filter_array_to_string, |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
30
|
|
|
|
|
|
|
# METHODS |
31
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub list { |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
1
|
1
|
4
|
my ( $self, %args ) = @_; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $tmpl = { |
38
|
1
|
|
|
|
|
9
|
fields => $common_template->{'fields'}, |
39
|
|
|
|
|
|
|
timeframe => { |
40
|
|
|
|
|
|
|
allow => [ '24h', '7d', '30d' ], |
41
|
|
|
|
|
|
|
default => '24h' |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
raw => {}, |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
5
|
my $params = sc_check_params( $tmpl, \%args ); |
47
|
1
|
|
|
|
|
5
|
my $raw = delete( $params->{'raw'} ); |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
10
|
my $notifications = $self->client->get( '/notification', $params ); |
50
|
|
|
|
|
|
|
|
51
|
1
|
50
|
|
|
|
11
|
return if ( !$notifications ); |
52
|
|
|
|
|
|
|
|
53
|
1
|
50
|
|
|
|
5
|
if ($raw) { |
54
|
0
|
0
|
|
|
|
0
|
return wantarray ? @{$notifications} : $notifications; |
|
0
|
|
|
|
|
0
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
1
|
50
|
|
|
|
6
|
return wantarray ? @{ sc_normalize_array($notifications) } : sc_normalize_array($notifications); |
|
0
|
|
|
|
|
0
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub get { |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
1
|
1
|
9
|
my ( $self, %args ) = @_; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $tmpl = { |
68
|
|
|
|
|
|
|
fields => $common_template->{'fields'}, |
69
|
1
|
|
|
|
|
16
|
id => $common_template->{'id'}, |
70
|
|
|
|
|
|
|
raw => {}, |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
7
|
my $params = sc_check_params( $tmpl, \%args ); |
74
|
1
|
|
|
|
|
8
|
my $raw = delete( $params->{'raw'} ); |
75
|
1
|
|
|
|
|
4
|
my $notification_id = delete( $params->{'id'} ); |
76
|
1
|
|
|
|
|
8
|
my $notification = $self->client->get( "/notification/$notification_id", $params ); |
77
|
|
|
|
|
|
|
|
78
|
1
|
50
|
|
|
|
5
|
return if ( !$notification ); |
79
|
1
|
50
|
|
|
|
5
|
return $notification if ($raw); |
80
|
1
|
|
|
|
|
5
|
return sc_normalize_hash($notification); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |