line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SecurityCenter::API::Repository; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
918
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
40
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
151
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
14
|
use parent 'Net::SecurityCenter::Base'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
133
|
use Net::SecurityCenter::Utils qw(:all); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1610
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.300'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $common_template = { |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
id => { |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
allow => qr/^\d+$/, |
19
|
|
|
|
|
|
|
messages => { |
20
|
|
|
|
|
|
|
required => 'Repository ID is required', |
21
|
|
|
|
|
|
|
allow => 'Invalid Repository ID', |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
fields => { |
26
|
|
|
|
|
|
|
filter => \&sc_filter_array_to_string, |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
32
|
|
|
|
|
|
|
# METHODS |
33
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub list { |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
1
|
4
|
my ( $self, %args ) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $tmpl = { |
40
|
|
|
|
|
|
|
fields => $common_template->{'fields'}, |
41
|
|
|
|
|
|
|
type => { |
42
|
|
|
|
|
|
|
allow => [ 'all', 'local', 'remote', 'offline' ], |
43
|
|
|
|
|
|
|
post_filter => sub { |
44
|
0
|
|
|
0
|
|
0
|
ucfirst(shift); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
}, |
47
|
1
|
|
|
|
|
10
|
raw => {}, |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
6
|
my $params = sc_check_params( $tmpl, \%args ); |
51
|
1
|
|
|
|
|
3
|
my $raw = delete( $params->{'raw'} ); |
52
|
1
|
|
|
|
|
13
|
my $repositories = $self->client->get( '/repository', $params ); |
53
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
|
|
5
|
return if ( !$repositories ); |
55
|
|
|
|
|
|
|
|
56
|
1
|
50
|
|
|
|
5
|
if ($raw) { |
57
|
0
|
0
|
|
|
|
0
|
return wantarray ? @{$repositories} : $repositories; |
|
0
|
|
|
|
|
0
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
1
|
50
|
|
|
|
7
|
return wantarray ? @{ sc_normalize_array($repositories) } : sc_normalize_array($repositories); |
|
0
|
|
|
|
|
0
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub get { |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
1
|
1
|
5
|
my ( $self, %args ) = @_; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $tmpl = { |
71
|
|
|
|
|
|
|
fields => $common_template->{'fields'}, |
72
|
1
|
|
|
|
|
5
|
id => $common_template->{'id'}, |
73
|
|
|
|
|
|
|
raw => {}, |
74
|
|
|
|
|
|
|
}; |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
4
|
my $params = sc_check_params( $tmpl, \%args ); |
77
|
1
|
|
|
|
|
3
|
my $raw = delete( $params->{'raw'} ); |
78
|
1
|
|
|
|
|
3
|
my $repository_id = delete( $params->{'id'} ); |
79
|
1
|
|
|
|
|
5
|
my $repository = $self->client->get( "/repository/$repository_id", $params ); |
80
|
|
|
|
|
|
|
|
81
|
1
|
50
|
|
|
|
5
|
return if ( !$repository ); |
82
|
1
|
50
|
|
|
|
4
|
return $repository if ($raw); |
83
|
1
|
|
|
|
|
4
|
return sc_normalize_hash($repository); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub get_device_info { |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $tmpl = { |
94
|
|
|
|
|
|
|
fields => $common_template->{'fields'}, |
95
|
0
|
|
|
|
|
|
id => $common_template->{'id'}, |
96
|
|
|
|
|
|
|
ip => {}, |
97
|
|
|
|
|
|
|
uuid => {}, |
98
|
|
|
|
|
|
|
dns_name => { |
99
|
|
|
|
|
|
|
remap => 'dnsName', |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
}; |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
my $params = sc_check_params( $tmpl, \%args ); |
104
|
0
|
|
|
|
|
|
my $repository_id = delete( $params->{'id'} ); |
105
|
0
|
|
|
|
|
|
my $device_info = $self->client->get( "/repository/$repository_id/deviceInfo", $params ); |
106
|
|
|
|
|
|
|
|
107
|
0
|
0
|
|
|
|
|
return if ( !$device_info ); |
108
|
0
|
|
|
|
|
|
return $device_info; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub get_ip_info { |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
0
|
1
|
|
my ( $self, %args ) = @_; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $tmpl = { |
119
|
0
|
|
|
|
|
|
fields => $common_template->{'fields'}, |
120
|
|
|
|
|
|
|
ip => {}, |
121
|
|
|
|
|
|
|
uuid => {}, |
122
|
|
|
|
|
|
|
dns_name => { |
123
|
|
|
|
|
|
|
remap => 'dnsName', |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
}; |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my $params = sc_check_params( $tmpl, \%args ); |
128
|
0
|
|
|
|
|
|
my $ip_info = $self->client->get( "/ipInfo", $params ); |
129
|
|
|
|
|
|
|
|
130
|
0
|
0
|
|
|
|
|
return if ( !$ip_info ); |
131
|
0
|
|
|
|
|
|
return $ip_info; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |