Zonalizer.pm

filter: Statementstmt 22.7% 10 / 44 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 5.5% 2 / 36 Podpod 100% 34 / 34 totaltotal 40.3% 46 / 114 CC 1 SCAR 6.6
CC
1
Cov
23%
ERR_DUPLICATE_ID
2.0
ERR_ID_NOT_FOUND
2.0
ERR_REVISION_MISSMATCH
2.0
CRAP 1.9
« Zonalizer/DB/Memory.pm ↑ Summary Zonalizer/Collector.pm »
1 package Lim::Plugin::Zonalizer;
2  
3 9 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 9 ▶use base qw(Exporter Lim::Component);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 our @EXPORT_OK = qw(ERR_DUPLICATE_ID ERR_ID_NOT_FOUND ERR_REVISION_MISSMATCH
8 ERR_INVALID_LIMIT ERR_INVALID_SORT_FIELD ERR_INTERNAL_DATABASE
9 ERR_INVALID_AFTER ERR_INVALID_BEFORE ERR_SPACE_MISSMATCH ERR_INVALID_NS
10 ERR_INVALID_DS ERR_UNDELEGATED_NOT_ALLOWED ERR_UNDELEGATED_FORCED
11 ERR_META_DATA_NOT_ALLOWED ERR_INVALID_META_DATA ERR_POLICY_NOT_FOUND
12 ERR_INVALID_FQDN ERR_QUEUE_FULL ERR_IPV4_NOT_ALLOWED ERR_IPV6_NOT_ALLOWED
13 ERR_NO_IP_PROTOCOL ERR_INVALID_LANG ERR_INVALID_API_VERSION
14 STATUS_RESERVED STATUS_QUEUED STATUS_ANALYZING STATUS_DONE STATUS_FAILED
15 STATUS_STOPPED STATUS_UNKNOWN
16 );
17 9 our %EXPORT_TAGS = (
18 err => [
19 qw(ERR_DUPLICATE_ID ERR_ID_NOT_FOUND ERR_REVISION_MISSMATCH
20 ERR_INVALID_LIMIT ERR_INVALID_SORT_FIELD ERR_INTERNAL_DATABASE
21 ERR_INVALID_AFTER ERR_INVALID_BEFORE ERR_SPACE_MISSMATCH
22 ERR_INVALID_NS ERR_INVALID_DS ERR_UNDELEGATED_NOT_ALLOWED
23 ERR_UNDELEGATED_FORCED ERR_META_DATA_NOT_ALLOWED
24 ERR_INVALID_META_DATA ERR_POLICY_NOT_FOUND ERR_INVALID_FQDN
25 ERR_QUEUE_FULL ERR_IPV4_NOT_ALLOWED ERR_IPV6_NOT_ALLOWED
26 ERR_NO_IP_PROTOCOL ERR_INVALID_LANG ERR_INVALID_API_VERSION)
27 ],
28 status => [
29 qw(STATUS_RESERVED STATUS_QUEUED STATUS_ANALYZING STATUS_DONE
30 STATUS_FAILED STATUS_STOPPED STATUS_UNKNOWN)
31 ]
32 );
33  
34 =encoding utf8
35  
36 =head1 NAME
37  
38 Lim::Plugin::Zonalizer - Analyze your zones with Zonemaster
39  
40 =head1 VERSION
41  
42 Version 1.02
43  
44 =cut
45  
46 9 our $VERSION = '1.02';
47  
48 =head1 SYNOPSIS
49  
50 use Lim::Plugin::Zonalizer;
51  
52 # Create a Server object
53 $server = Lim::Plugin::Zonalizer->Server;
54  
55 # Create a Client object
56 $client = Lim::Plugin::Zonalizer->Client;
57  
58 # Create a CLI object
59 $cli = Lim::Plugin::Zonalizer->CLI;
60  
61 =head1 DESCRIPTION
62  
63 ...
64  
65 =head1 ERRORS
66  
67 use Lim::Plugin::Zonalizer qw(:err);
68  
69 See API documentation for full description about errors.
70  
71 =over 4
72  
73 =item ERR_DUPLICATE_ID
74  
75 =item ERR_ID_NOT_FOUND
76  
77 =item ERR_REVISION_MISSMATCH
78  
79 =item ERR_INVALID_LIMIT
80  
81 =item ERR_INVALID_SORT_FIELD
82  
83 =item ERR_INTERNAL_DATABASE
84  
85 =item ERR_INVALID_AFTER
86  
87 =item ERR_INVALID_BEFORE
88  
89 =item ERR_SPACE_MISSMATCH
90  
91 =item ERR_INVALID_NS
92  
93 =item ERR_INVALID_DS
94  
95 =item ERR_UNDELEGATED_NOT_ALLOWED
96  
97 =item ERR_UNDELEGATED_FORCED
98  
99 =item ERR_META_DATA_NOT_ALLOWED
100  
101 =item ERR_INVALID_META_DATA
102  
103 =item ERR_POLICY_NOT_FOUND
104  
105 =item ERR_INVALID_FQDN
106  
107 =item ERR_QUEUE_FULL
108  
109 =item ERR_IPV4_NOT_ALLOWED
110  
111 =item ERR_IPV6_NOT_ALLOWED
112  
113 =item ERR_NO_IP_PROTOCOL
114  
115 =item ERR_INVALID_LANG
116  
117 =item ERR_INVALID_API_VERSION
118  
119 =back
120  
121 =cut
122  
123 0 ▶sub ERR_DUPLICATE_ID() { return 'duplicate_id_found' }
Subroutine ERR_DUPLICATE_ID: not called CC=1 SCAR=6.9
Pod documented
124 0 ▶sub ERR_ID_NOT_FOUND() { return 'id_not_found' }
Subroutine ERR_ID_NOT_FOUND: not called CC=1 SCAR=6.9
Pod documented
125 0 ▶sub ERR_REVISION_MISSMATCH() { return 'revision_missmatch' }
Subroutine ERR_REVISION_MISSMATCH: not called CC=1 SCAR=6.9
Pod documented
126 0 ▶sub ERR_INVALID_LIMIT() { return 'invalid_limit' }
Subroutine ERR_INVALID_LIMIT: not called CC=1 SCAR=6.9
Pod documented
127 0 ▶sub ERR_INVALID_SORT_FIELD() { return 'invalid_sort_field' }
Subroutine ERR_INVALID_SORT_FIELD: not called CC=1 SCAR=6.9
Pod documented
128 0 ▶sub ERR_INTERNAL_DATABASE() { return 'internal_database_error' }
Subroutine ERR_INTERNAL_DATABASE: not called CC=1 SCAR=6.9
Pod documented
129 0 ▶sub ERR_INVALID_AFTER() { return 'invalid_after' }
Subroutine ERR_INVALID_AFTER: not called CC=1 SCAR=6.9
Pod documented
130 0 ▶sub ERR_INVALID_BEFORE() { return 'invalid_before' }
Subroutine ERR_INVALID_BEFORE: not called CC=1 SCAR=6.9
Pod documented
131 0 ▶sub ERR_SPACE_MISSMATCH() { return 'space_missmatch' }
Subroutine ERR_SPACE_MISSMATCH: not called CC=1 SCAR=6.9
Pod documented
132 0 ▶sub ERR_INVALID_NS() { return 'invalid_ns' }
Subroutine ERR_INVALID_NS: not called CC=1 SCAR=6.9
Pod documented
133 0 ▶sub ERR_INVALID_DS() { return 'invalid_ds' }
Subroutine ERR_INVALID_DS: not called CC=1 SCAR=6.9
Pod documented
134 0 ▶sub ERR_UNDELEGATED_NOT_ALLOWED { return 'undelegated_not_allowed' }
Subroutine ERR_UNDELEGATED_NOT_ALLOWED: not called CC=1 SCAR=6.9
Pod documented
135 0 ▶sub ERR_UNDELEGATED_FORCED { return 'undelegated_forced' }
Subroutine ERR_UNDELEGATED_FORCED: not called CC=1 SCAR=6.9
Pod documented
136 0 ▶sub ERR_META_DATA_NOT_ALLOWED { return 'meta_data_not_allowed' }
Subroutine ERR_META_DATA_NOT_ALLOWED: not called CC=1 SCAR=6.9
Pod documented
137 0 ▶sub ERR_INVALID_META_DATA { return 'invalid_meta_data' }
Subroutine ERR_INVALID_META_DATA: not called CC=1 SCAR=6.9
Pod documented
138 0 ▶sub ERR_POLICY_NOT_FOUND { return 'policy_not_found' }
Subroutine ERR_POLICY_NOT_FOUND: not called CC=1 SCAR=6.9
Pod documented
139 0 ▶sub ERR_INVALID_FQDN { return 'invalid_fqdn' }
Subroutine ERR_INVALID_FQDN: not called CC=1 SCAR=6.9
Pod documented
140 0 ▶sub ERR_QUEUE_FULL { return 'queue_full' }
Subroutine ERR_QUEUE_FULL: not called CC=1 SCAR=6.9
Pod documented
141 0 ▶sub ERR_IPV4_NOT_ALLOWED { return 'ipv4_not_allowed' }
Subroutine ERR_IPV4_NOT_ALLOWED: not called CC=1 SCAR=6.9
Pod documented
142 0 ▶sub ERR_IPV6_NOT_ALLOWED { return 'ipv6_not_allowed' }
Subroutine ERR_IPV6_NOT_ALLOWED: not called CC=1 SCAR=6.9
Pod documented
143 0 ▶sub ERR_NO_IP_PROTOCOL { return 'no_ip_protocol' }
Subroutine ERR_NO_IP_PROTOCOL: not called CC=1 SCAR=6.9
Pod documented
144 0 ▶sub ERR_INVALID_LANG { return 'invalid_lang' }
Subroutine ERR_INVALID_LANG: not called CC=1 SCAR=6.9
Pod documented
145 0 ▶sub ERR_INVALID_API_VERSION { return 'invalid_api_version' }
Subroutine ERR_INVALID_API_VERSION: not called CC=1 SCAR=6.9
Pod documented
146  
147 =head1 STATUSES
148  
149 use Lim::Plugin::Zonalizer qw(:status);
150  
151 See API documentation for full description about statuses.
152  
153 =over 4
154  
155 =item STATUS_RESERVED
156  
157 =item STATUS_QUEUED
158  
159 =item STATUS_ANALYZING
160  
161 =item STATUS_DONE
162  
163 =item STATUS_FAILED
164  
165 =item STATUS_STOPPED
166  
167 =item STATUS_UNKNOWN
168  
169 =back
170  
171 =cut
172  
173 0 ▶sub STATUS_RESERVED() { return 'reserved' }
Subroutine STATUS_RESERVED: not called CC=1 SCAR=6.9
Pod documented
174 0 ▶sub STATUS_QUEUED() { return 'queued' }
Subroutine STATUS_QUEUED: not called CC=1 SCAR=6.9
Pod documented
175 0 ▶sub STATUS_ANALYZING() { return 'analyzing' }
Subroutine STATUS_ANALYZING: not called CC=1 SCAR=6.9
Pod documented
176 0 ▶sub STATUS_DONE() { return 'done' }
Subroutine STATUS_DONE: not called CC=1 SCAR=6.9
Pod documented
177 0 ▶sub STATUS_FAILED() { return 'failed' }
Subroutine STATUS_FAILED: not called CC=1 SCAR=6.9
Pod documented
178 0 ▶sub STATUS_STOPPED() { return 'stopped' }
Subroutine STATUS_STOPPED: not called CC=1 SCAR=6.9
Pod documented
179 0 ▶sub STATUS_UNKNOWN() { return 'unknown' }
Subroutine STATUS_UNKNOWN: not called CC=1 SCAR=6.9
Pod documented
180  
181 =head1 METHODS
182  
183 =over 4
184  
185 =item $plugin_name = Lim::Plugin::Zonalizer->Name
186  
187 Returns the plugin's name.
188  
189 =cut
190  
191 0 ▶sub Name {
Subroutine Name: not called CC=1 SCAR=6.9
Pod documented
192 0 'Zonalizer';
193 }
194  
195 =item $plugin_description = Lim::Plugin::Zonalizer->Description
196  
197 Returns the plugin's description.
198  
199 =cut
200  
201 0 ▶sub Description {
Subroutine Description: not called CC=1 SCAR=6.9
Pod documented
202 0 'Analyze your zones with Zonemaster.';
203 }
204  
205 =item $call_hash_ref = Lim::Plugin::Zonalizer->Calls
206  
207 Returns a hash reference to the calls that can be made to this plugin, used both
208 in Server and Client to verify input and output arguments.
209  
210 See CALLS for list of calls and arguments.
211  
212 =cut
213  
214 0 ▶sub Calls {
Subroutine Calls: not called CC=1 SCAR=6.9
Pod documented
215 {
216 0 Read1 => {
217 uri_map => [
218 'version => ReadVersion version=1',
219 'status => ReadStatus version=1',
220 'analysis => ReadAnalysis version=1',
221 'analysis/id=[\w-]+ => ReadAnalyze version=1',
222 'analysis/id=[\w-]+/status => ReadAnalyzeStatus version=1',
223 'policies => ReadPolicies version=1',
224 'policies/name=[\w-]+ => ReadPolicy version=1'
225 ]
226 },
227 Create1 => { uri_map => ['analysis => CreateAnalyze version=1'] },
228 Update1 => { uri_map => [] },
229 Delete1 => {
230 uri_map => [
231 'analysis => DeleteAnalysis version=1',
232 'analysis/id=[\w-]+ => DeleteAnalyze version=1'
233 ]
234 },
235  
236 ReadVersion => {
237 in => { version => 'string' },
238 out => {
239 version => 'string',
240 zonemaster => {
241 version => 'string',
242 tests => {
243 name => 'string',
244 version => 'string'
245 }
246 }
247 }
248 },
249  
250 ReadStatus => {
251 in => { version => 'string' },
252 out => {
253 api => {
254 requests => 'integer',
255 errors => 'integer'
256 },
257 analysis => {
258 ongoing => 'integer',
259 completed => 'integer',
260 failed => 'integer'
261 }
262 }
263 },
264  
265 ReadAnalysis => {
266 in => {
267 version => 'integer',
268 space => 'string optional',
269 search => 'string optional',
270 ongoing => 'integer optional',
271 results => 'integer optional',
272 lang => 'string optional',
273 limit => 'integer optional',
274 before => 'string optional',
275 after => 'string optional',
276 sort => 'string optional',
277 direction => 'string optional',
278 base_url => 'integer optional'
279 },
280 out => {
281 analysis => {
282 id => 'string',
283 url => 'string',
284 fqdn => 'string',
285 policy => {
286 name => 'string',
287 display => 'string',
288 description => 'string optional'
289 },
290 status => 'string',
291 error => {
292 code => 'string',
293 message => 'string'
294 },
295 progress => 'integer',
296 created => 'integer',
297 updated => 'integer',
298 results => {
299 _id => 'integer',
300 args => { '' => 'swallow' },
301 level => 'string',
302 module => 'string',
303 tag => 'string',
304 timestamp => 'integer',
305 message => 'string'
306 },
307 summary => {
308 '' => 'single',
309 notice => 'integer',
310 warning => 'integer',
311 error => 'integer',
312 critical => 'integer'
313 },
314 ipv4 => 'integer',
315 ipv6 => 'integer',
316 ns => {
317 fqdn => 'string',
318 ip => 'string optional'
319 },
320 ds => {
321 keytag => 'string',
322 algorithm => 'string',
323 type => 'string',
324 digest => 'string'
325 },
326 meta_data => {
327 key => 'string',
328 value => 'string'
329 }
330 },
331 paging => {
332 '' => 'single',
333 cursors => {
334 '' => 'required single',
335 after => 'string',
336 before => 'string'
337 },
338 previous => 'string optional',
339 next => 'string optional'
340 }
341 }
342 },
343 DeleteAnalysis => {
344 in => {
345 version => 'integer',
346 space => 'string optional',
347 }
348 },
349  
350 CreateAnalyze => {
351 in => {
352 version => 'integer',
353 space => 'string optional',
354 fqdn => 'string',
355 policy => 'string optional',
356 ipv4 => 'integer optional',
357 ipv6 => 'integer optional',
358 ns => {
359 fqdn => 'string',
360 ip => 'string optional'
361 },
362 ds => {
363 keytag => 'string',
364 algorithm => 'string',
365 type => 'string',
366 digest => 'string'
367 },
368 meta_data => {
369 key => 'string',
370 value => 'string'
371 }
372 },
373 out => { id => 'string' }
374 },
375 ReadAnalyze => {
376 in => {
377 version => 'integer',
378 id => 'string',
379 space => 'string optional',
380 results => 'integer optional',
381 lang => 'string optional',
382 last_results => 'integer optional'
383 },
384 out => {
385 id => 'string',
386 url => 'string',
387 fqdn => 'string',
388 policy => {
389 name => 'string',
390 display => 'string',
391 description => 'string optional'
392 },
393 status => 'string',
394 error => {
395 code => 'string',
396 message => 'string'
397 },
398 progress => 'integer',
399 created => 'integer',
400 updated => 'integer',
401 results => {
402 _id => 'integer',
403 args => { '' => 'swallow' },
404 level => 'string',
405 module => 'string',
406 tag => 'string',
407 timestamp => 'integer',
408 message => 'string'
409 },
410 summary => {
411 '' => 'single',
412 notice => 'integer',
413 warning => 'integer',
414 error => 'integer',
415 critical => 'integer'
416 },
417 ipv4 => 'integer',
418 ipv6 => 'integer',
419 ns => {
420 fqdn => 'string',
421 ip => 'string optional'
422 },
423 ds => {
424 keytag => 'string',
425 algorithm => 'string',
426 type => 'string',
427 digest => 'string'
428 },
429 meta_data => {
430 key => 'string',
431 value => 'string'
432 }
433 }
434 },
435 ReadAnalyzeStatus => {
436 in => {
437 version => 'integer',
438 id => 'string',
439 space => 'string optional',
440 },
441 out => {
442 status => 'string',
443 progress => 'integer',
444 updated => 'integer'
445 }
446 },
447 DeleteAnalyze => {
448 in => {
449 version => 'integer',
450 id => 'string',
451 space => 'string optional',
452 }
453 },
454  
455 ReadPolicies => {
456 in => { version => 'integer' },
457 out => {
458 policies => {
459 name => 'string',
460 display => 'string',
461 description => 'string optional'
462 }
463 }
464 },
465 ReadPolicy => {
466 in => {
467 version => 'integer',
468 name => 'string'
469 },
470 out => {
471 name => 'string',
472 display => 'string',
473 description => 'string optional'
474 }
475 }
476 };
477 }
478  
479 =item $command_hash_ref = Lim::Plugin::Zonalizer->Commands
480  
481 Returns a hash reference to the CLI commands that can be made by this plugin.
482  
483 See COMMANDS for list of commands and arguments.
484  
485 =cut
486  
487 0 ▶sub Commands {
Subroutine Commands: not called CC=1 SCAR=6.9
Pod documented
488 0 {};
489 }
490  
491 =back
492  
493 =head1 CALLS
494  
495 See L<Lim::Component::Client> on how calls and callback functions should be
496 used.
497  
498 =head1 COMMANDS
499  
500 ...
501  
502 =head1 AUTHOR
503  
504 Jerry Lundström, C<< <lundstrom.jerry@gmail.com> >>
505  
506 =head1 BUGS
507  
508 Please report any bugs or feature requests to L<https://github.com/jelu/lim-plugin-zonalizer/issues>.
509  
510 =head1 SUPPORT
511  
512 You can find documentation for this module with the perldoc command.
513  
514 perldoc Lim::Plugin::Zonalizer
515  
516 You can also look for information at:
517  
518 =over 4
519  
520 =item * Lim issue tracker (report bugs here)
521  
522 L<https://github.com/jelu/lim-plugin-zonalizer/issues>
523  
524 =back
525  
526 =head1 ACKNOWLEDGEMENTS
527  
528 =head1 LICENSE AND COPYRIGHT
529  
530 Copyright 2015-2016 Jerry Lundström
531 Copyright 2015-2016 IIS (The Internet Foundation in Sweden)
532  
533 This program is free software; you can redistribute it and/or modify it
534 under the terms of either: the GNU General Public License as published
535 by the Free Software Foundation; or the Artistic License.
536  
537 See http://dev.perl.org/licenses/ for more information.
538  
539  
540 =cut
541  
542 9 1; # End of Lim::Plugin::Zonalizer
« Zonalizer/DB/Memory.pm ↑ Summary Zonalizer/Collector.pm »