Net/SecurityCenter/API/System.pm

filter: Statementstmt 73.3% 55 / 75 Branchbran 66.6% 12 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 58.3% 7 / 12 Podpod 100% 8 / 8 totaltotal 72.5% 82 / 113 CC 11 SCAR 13.2
CC
11
Cov
72%
debug
7.0
get_diagnostics_info
3.2
info
3.0
CRAP 3.7
« Net/SecurityCenter/API/Ticket.pm ↑ Summary Net/SecurityCenter/API/Zone.pm »
1 package Net::SecurityCenter::API::System;
2  
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use parent 'Net::SecurityCenter::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Net::SecurityCenter::Utils qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION = '0.311';
11  
12 #-------------------------------------------------------------------------------
13 # METHODS
14 #-------------------------------------------------------------------------------
15  
16 0 ▶sub get_status {
Subroutine get_status: not called CC=1 SCAR=6.9
Pod documented
17  
18 0 my ( $self, %args ) = @_;
19  
20 0 deprecated
21 '"Net::SecurityCenter::API::System->get_status" is DEPRECATED use "Net::SecurityCenter::API::Status->status" instead';
22  
23 0 return;
24  
25 }
26  
27 #-------------------------------------------------------------------------------
28  
29 0 ▶sub get_info {
Subroutine get_info: not called CC=1 SCAR=6.9
Pod documented
30  
31 0 my ( $self, %args ) = @_;
32  
33 0 deprecated
34 '"Net::SecurityCenter::API::Status->get_info" is DEPRECATED use "Net::SecurityCenter::API::Status->info"';
35  
36 0 return $self->info( \%args );
37  
38 }
39  
40 #-------------------------------------------------------------------------------
41  
42 1 ▶sub info {
Subroutine info: called CC=3 SCAR=11.1
Pod documented
43  
44 1 my ( $self, %args ) = @_;
45  
46 1 my $tmpl = { raw => {}, };
47  
48 1 my $params = sc_check_params( $tmpl, \%args );
49 1 my $raw = delete( $params->{'raw'} );
50 1 my $info = $self->client->get('/system');
51  
52 1 ▶ return if ( !$info );
Branch: 1 branch
BranchTrueFalseTotal
unless $info 0 1 1
53 1 ▶ return $info if ($raw);
Branch: 1 branch
BranchTrueFalseTotal
if $raw 0 1 1
54  
55 1 return sc_normalize_hash($info);
56  
57 }
58  
59 #-------------------------------------------------------------------------------
60  
61 3 ▶sub debug {
Subroutine debug: called CC=7 SCAR=19.5
Pod documented
62  
63 3 my ( $self, %args ) = @_;
64  
65 3 my $tmpl = { name => {}, id => {}, category => {} };
66  
67 3 my $params = sc_check_params( $tmpl, \%args );
68 3 my $id = delete( $params->{'id'} );
69 3 my $name = delete( $params->{'name'} );
70 3 my $category = delete( $params->{'category'} );
71 3 my $debug = $self->client->get('/system/debug');
72  
73 3 ▶ return if ( !$debug );
Branch: 1 branch
BranchTrueFalseTotal
unless $debug 0 3 3
74  
75 3 my $id_results = {};
76 3 my $name_results = {};
77 3 my $category_results = {};
78  
79 3 foreach my $item ( @{$debug} ) {
80  
81 216 $id_results->{ $item->{id} } = $item;
82 216 $name_results->{ $item->{name} } = $item;
83  
84 216 ▶ if ( !defined( $category_results->{ $item->{category} } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $$category_results{$item->{"category"}}) 9 207 216
85 9 $category_results->{ $item->{category} } = ();
86 }
87  
88 216 push @{ $category_results->{ $item->{category} } }, $item;
89  
90 }
91  
92 3 ▶ if ($name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name) 0 3 3
93 0 return $name_results->{$name};
94 }
95  
96 3 ▶ if ($id) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id) 1 2 3
97 1 return $id_results->{$id};
98 }
99  
100 2 ▶ if ($category) {
Branch: 1 branch
BranchTrueFalseTotal
if ($category) 1 1 2
101 1 return $category_results->{$category};
102 }
103  
104 1 return $debug;
105  
106 }
107  
108 #-------------------------------------------------------------------------------
109  
110 1 ▶sub get_diagnostics_info {
Subroutine get_diagnostics_info: called CC=3 SCAR=11.7
Pod documented
111  
112 1 my ( $self, %args ) = @_;
113  
114 1 my $tmpl = { raw => {}, };
115  
116 1 my $params = sc_check_params( $tmpl, \%args );
117 1 my $raw = delete( $params->{'raw'} );
118 1 my $info = $self->client->get('/system/diagnostics');
119  
120 1 ▶ if ( !$info ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($info) 0 1 1
121 0 return;
122 }
123  
124 1 ▶ if ($raw) {
Branch: 1 branch
BranchTrueFalseTotal
if ($raw) 0 1 1
125 0 return $info;
126 }
127  
128 1 return sc_normalize_hash($info);
129  
130 }
131  
132 #-------------------------------------------------------------------------------
133  
134 0 ▶sub generate_diagnostics_app_status {
Subroutine generate_diagnostics_app_status: not called CC=1 SCAR=6.9
Pod documented
135  
136 0 my ($self) = @_;
137 0 $self->client->post( '/system/diagnostics/generate', { 'task' => 'appStatus' } );
138 0 return 1;
139  
140 }
141  
142 #-------------------------------------------------------------------------------
143  
144 0 ▶sub generate_diagnostics_file {
Subroutine generate_diagnostics_file: not called CC=1 SCAR=6.9
Pod documented
145  
146 0 my ( $self, %args ) = @_;
147  
148 0 my $tmpl = {
149 type => {
150 default => ['all'],
151 allow => [
152 'all', 'apacheLog', 'configuration', 'dependencies', 'dirlist', 'environment',
153 'installLog', 'logs', 'sanitize', 'scans', 'serverConf', 'setup',
154 'sysinfo', 'upgradeLog'
155 ]
156 },
157 };
158  
159 0 my $params = sc_check_params( $tmpl, \%args );
160 0 my $options = delete( $params->{'type'} );
161  
162 return $self->client->post( '/system/diagnostics/generate',
163 0 { 'task' => 'diagnosticsFile', 'options' => \@{$options} } );
164  
165 }
166  
167 #-------------------------------------------------------------------------------
168  
169 0 ▶sub download_diagnostics {
Subroutine download_diagnostics: not called CC=1 SCAR=6.9
Pod documented
170  
171 0 my ($self) = @_;
172 0 return $self->client->post('/system/diagnostics/download');
173  
174 }
175  
176 #-------------------------------------------------------------------------------
177  
178 2 1;
179  
180 __END__
« Net/SecurityCenter/API/Ticket.pm ↑ Summary Net/SecurityCenter/API/Zone.pm »