line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter::API::Feed; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
847
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
40
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
107
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use parent 'Net::SecurityCenter::Base'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
23
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
135
|
use Net::SecurityCenter::Utils qw(:all); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1258
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.311'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# METHODS |
16
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub status { |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $tmpl = { |
23
|
|
|
|
|
|
|
type => { |
24
|
|
|
|
|
|
|
default => 'all', |
25
|
|
|
|
|
|
|
allow => [ 'all', 'active', 'passive', 'lce', 'sc' ] |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
raw => {} |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $params = sc_check_params( $tmpl, \%args ); |
31
|
0
|
|
|
|
|
|
my $type = delete( $params->{'type'} ); |
32
|
0
|
|
|
|
|
|
my $raw = delete( $params->{'raw'} ); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $feed_path = '/feed'; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if ( $type ne 'all' ) { |
37
|
0
|
|
|
|
|
|
$feed_path .= "/$type"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $feed = $self->client->get($feed_path); |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
return if ( !$feed ); |
43
|
0
|
0
|
|
|
|
|
return $feed if ($raw); |
44
|
0
|
|
|
|
|
|
return sc_normalize_hash($feed); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub update { |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $tmpl = { |
55
|
|
|
|
|
|
|
type => { |
56
|
|
|
|
|
|
|
default => 'all', |
57
|
|
|
|
|
|
|
allow => [ 'all', 'active', 'passive', 'lce', 'sc' ] |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
}; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $params = sc_check_params( $tmpl, \%args ); |
62
|
0
|
|
|
|
|
|
my $type = delete( $params->{'type'} ); |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$self->client->post("/feed/$type/update"); |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return 1; # TODO |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub process { |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
my $tmpl = { |
77
|
|
|
|
|
|
|
type => { |
78
|
|
|
|
|
|
|
required => 1, |
79
|
|
|
|
|
|
|
allow => [ 'all', 'active', 'passive', 'lce', 'sc' ] |
80
|
|
|
|
|
|
|
}, |
81
|
|
|
|
|
|
|
filename => { |
82
|
|
|
|
|
|
|
required => 1, |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
}; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $params = sc_check_params( $tmpl, \%args ); |
87
|
0
|
|
|
|
|
|
my $type = delete( $params->{'type'} ); |
88
|
0
|
|
|
|
|
|
my $filename = delete( $params->{'filename'} ); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $sc_filename = $self->client->upload($filename)->{'filename'}; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$self->client->post( "/feed/$type/process", { 'filename' => $sc_filename } ); |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return 1; # TODO |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |