]> git.proxmox.com Git - pmg-api.git/commitdiff
PMG/API2/Quarantine.pm - add virusstatus API
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Aug 2017 05:58:03 +0000 (07:58 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 24 Aug 2017 05:58:03 +0000 (07:58 +0200)
PMG/API2/Quarantine.pm

index 2e5bf9b105ec84aac44937b4cf6029256f4740a6..4d966e9f939d4b8d975ed1a34bde8f22df6587cf 100644 (file)
@@ -169,6 +169,7 @@ __PACKAGE__->register_method ({
            { name => 'spamusers' },
            { name => 'spamstatus' },
            { name => 'virus' },
+           { name => 'virusstatus' },
            { name => 'quarusers' },
        ];
 
@@ -718,6 +719,42 @@ __PACKAGE__->register_method ({
        return $res;
     }});
 
+__PACKAGE__->register_method ({
+    name => 'virusstatus',
+    path => 'virusstatus',
+    method => 'GET',
+    permissions => { check => [ 'admin', 'qmanager', 'audit'] },
+    description => "Get Virus Quarantine Status",
+    parameters => {
+       additionalProperties => 0,
+       properties => {},
+    },
+    returns => {
+       type => "object",
+       properties => {
+           count => {
+               description => 'Number of stored mails.',
+               type => 'integer',
+           },
+           mbytes => {
+               description => "Estimated disk space usage in MByte.",
+               type => 'number',
+           },
+           avgbytes => {
+               description => "Average size of stored mails in bytes.",
+               type => 'number',
+           },
+       },
+    },
+    code => sub {
+       my ($param) = @_;
+
+       my $dbh = PMG::DBTools::open_ruledb();
+       my $ref = PMG::DBTools::get_quarantine_count($dbh, 'V');
+
+       return $ref;
+    }});
+
 __PACKAGE__->register_method ({
     name => 'content',
     path => 'content',