]>
Commit | Line | Data |
---|---|---|
d17c5265 DM |
1 | package PMG::API2::ClamAV; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use PVE::Tools; | |
7 | use PVE::SafeSyslog; | |
8 | use PVE::INotify; | |
9 | use PVE::Exception qw(raise_param_exc); | |
10 | use PVE::RESTHandler; | |
11 | use PVE::RESTEnvironment; | |
12 | use PVE::JSONSchema qw(get_standard_option); | |
13 | ||
14 | use PMG::Utils; | |
15 | ||
16 | use base qw(PVE::RESTHandler); | |
17 | ||
18 | ||
19 | __PACKAGE__->register_method ({ | |
20 | name => 'index', | |
21 | path => '', | |
22 | method => 'GET', | |
23 | description => "Directory index.", | |
24 | proxyto => 'node', | |
25 | protected => 1, | |
26 | parameters => { | |
27 | additionalProperties => 0, | |
28 | properties => { | |
29 | node => get_standard_option('pve-node'), | |
30 | }, | |
31 | }, | |
32 | returns => { | |
33 | type => 'array', | |
34 | items => { | |
35 | type => "object", | |
36 | properties => {}, | |
37 | }, | |
38 | links => [ { rel => 'child', href => "{subdir}" } ], | |
39 | }, | |
40 | code => sub { | |
41 | my ($param) = @_; | |
42 | ||
43 | my $res = []; | |
44 | ||
45 | push @$res, { subdir => "dbstat" }; | |
46 | ||
47 | return $res; | |
48 | }}); | |
49 | ||
50 | __PACKAGE__->register_method({ | |
51 | name => 'dbstat', | |
52 | path => 'dbstat', | |
53 | method => 'GET', | |
54 | description => "ClamAV virus database status.", | |
55 | parameters => { | |
56 | additionalProperties => 0, | |
57 | properties => { | |
58 | node => get_standard_option('pve-node'), | |
59 | }, | |
60 | }, | |
61 | returns => { | |
62 | type => 'array', | |
63 | items => { | |
64 | type => "object", | |
65 | properties => { | |
66 | type => { type => 'string' }, | |
67 | build_time => { type => 'string' }, | |
68 | version => { type => 'string', optional => 1 }, | |
69 | nsigs => { type => 'integer' }, | |
70 | }, | |
71 | }, | |
72 | }, | |
73 | code => sub { | |
74 | my ($param) = @_; | |
75 | ||
76 | return PMG::Utils::clamav_dbstat(); | |
77 | }}); | |
78 | ||
79 | 1; |