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