]> git.proxmox.com Git - pmg-api.git/blame - PMG/API2.pm
add virus and spam statistic API
[pmg-api.git] / PMG / API2.pm
CommitLineData
1360e6f0
DM
1package PMG::API2;
2
3use strict;
4use warnings;
5
6use PVE::RESTHandler;
7use PVE::JSONSchema;
8
9use PMG::API2::AccessControl;
10use PMG::API2::Nodes;
a643bba6 11use PMG::API2::Config;
b66faa68 12use PMG::API2::Quarantine;
0678d564 13use PMG::pmgcfg;
1360e6f0
DM
14
15use base qw(PVE::RESTHandler);
16
a643bba6
DM
17__PACKAGE__->register_method ({
18 subclass => "PMG::API2::Config",
19 path => 'config',
20});
21
1360e6f0 22__PACKAGE__->register_method ({
0678d564 23 subclass => "PMG::API2::Nodes",
1360e6f0
DM
24 path => 'nodes',
25});
26
27__PACKAGE__->register_method ({
0678d564 28 subclass => "PMG::API2::AccessControl",
1360e6f0 29 path => 'access',
b66faa68
DM
30 });
31
32__PACKAGE__->register_method ({
33 subclass => "PMG::API2::Quarantine",
34 path => 'quarantine',
1360e6f0
DM
35});
36
37__PACKAGE__->register_method ({
38 name => 'index',
39 path => '',
40 method => 'GET',
41 permissions => { user => 'all' },
42 description => "Directory index.",
43 parameters => {
44 additionalProperties => 0,
45 properties => {},
46 },
47 returns => {
48 type => 'array',
49 items => {
50 type => "object",
51 properties => {
52 subdir => { type => 'string' },
53 },
54 },
55 links => [ { rel => 'child', href => "{subdir}" } ],
56 },
57 code => sub {
58 my ($resp, $param) = @_;
59
0678d564 60 my $res = [
b66faa68 61 { subdir => 'access' },
a643bba6 62 { subdir => 'config' },
0678d564
DM
63 { subdir => 'nodes' },
64 { subdir => 'version' },
b66faa68 65 { subdir => 'quarantine' },
0678d564 66 ];
1360e6f0
DM
67
68 return $res;
69 }});
70
71
0678d564
DM
72__PACKAGE__->register_method ({
73 name => 'version',
74 path => 'version',
75 method => 'GET',
76 permissions => { user => 'all' },
77 description => "API version details.",
78 parameters => {
79 additionalProperties => 0,
80 properties => {},
81 },
82 returns => {
83 type => "object",
84 properties => {
85 version => { type => 'string' },
86 release => { type => 'string' },
87 repoid => { type => 'string' },
88 },
89 },
90 code => sub {
91 my ($param) = @_;
92
93 return PMG::pmgcfg::version_info();
94 }});
95
1360e6f0 961;