line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter::API::Notification; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use parent 'Net::SecurityCenter::Base'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
60
|
use Net::SecurityCenter::Utils qw(:all); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
525
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.300'; |
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
|
3
|
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
|
|
|
|
|
2
|
my $raw = delete( $params->{'raw'} ); |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
13
|
my $notifications = $self->client->get( '/notification', $params ); |
50
|
|
|
|
|
|
|
|
51
|
1
|
50
|
|
|
|
5
|
return if ( !$notifications ); |
52
|
|
|
|
|
|
|
|
53
|
1
|
50
|
|
|
|
4
|
if ($raw) { |
54
|
0
|
0
|
|
|
|
0
|
return wantarray ? @{$notifications} : $notifications; |
|
0
|
|
|
|
|
0
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
1
|
50
|
|
|
|
8
|
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
|
5
|
my ( $self, %args ) = @_; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
my $tmpl = { |
68
|
|
|
|
|
|
|
fields => $common_template->{'fields'}, |
69
|
1
|
|
|
|
|
6
|
id => $common_template->{'id'}, |
70
|
|
|
|
|
|
|
raw => {}, |
71
|
|
|
|
|
|
|
}; |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
5
|
my $params = sc_check_params( $tmpl, \%args ); |
74
|
1
|
|
|
|
|
3
|
my $raw = delete( $params->{'raw'} ); |
75
|
1
|
|
|
|
|
3
|
my $notification_id = delete( $params->{'id'} ); |
76
|
1
|
|
|
|
|
5
|
my $notification = $self->client->get( "/notification/$notification_id", $params ); |
77
|
|
|
|
|
|
|
|
78
|
1
|
50
|
|
|
|
5
|
return if ( !$notification ); |
79
|
1
|
50
|
|
|
|
4
|
return $notification if ($raw); |
80
|
1
|
|
|
|
|
5
|
return sc_normalize_hash($notification); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |