]> git.proxmox.com Git - pmg-api.git/blame - PMG/API2/ClamAV.pm
add ClamAV API, depend on clamav-unofficial-sigs
[pmg-api.git] / PMG / API2 / ClamAV.pm
CommitLineData
d17c5265
DM
1package PMG::API2::ClamAV;
2
3use strict;
4use warnings;
5
6use PVE::Tools;
7use PVE::SafeSyslog;
8use PVE::INotify;
9use PVE::Exception qw(raise_param_exc);
10use PVE::RESTHandler;
11use PVE::RESTEnvironment;
12use PVE::JSONSchema qw(get_standard_option);
13
14use PMG::Utils;
15
16use 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
791;