]> git.proxmox.com Git - pmg-api.git/blame - PMG/API2/When.pm
delete/deliver_quarantined_mail: use receiver instead of pmail
[pmg-api.git] / PMG / API2 / When.pm
CommitLineData
2499333b
DM
1package PMG::API2::When;
2
3use strict;
4use warnings;
5use Data::Dumper;
6
7use PVE::SafeSyslog;
8use PVE::Tools qw(extract_param);
9use HTTP::Status qw(:constants);
10use PVE::JSONSchema qw(get_standard_option);
11use PVE::RESTHandler;
12use PVE::INotify;
13
14use PMG::Config;
15
16use PMG::RuleDB::TimeFrame;
17use PMG::RuleDB;
18
19use base qw(PVE::RESTHandler);
20
21__PACKAGE__->register_method ({
22 name => 'index',
23 path => '',
24 method => 'GET',
25 description => "Directory index.",
b07f4d68 26 permissions => { check => [ 'admin', 'audit' ] },
2499333b
DM
27 parameters => {
28 additionalProperties => 0,
29 properties => {
30 ogroup => {
31 description => "Object Group ID.",
32 type => 'integer',
33 },
34 },
35 },
36 returns => {
37 type => 'array',
38 items => {
39 type => "object",
40 properties => {
41 subdir => { type => 'string'},
42 },
43 },
44 links => [ { rel => 'child', href => "{subdir}" } ],
45 },
46 code => sub {
47 my ($param) = @_;
48
49 return [
50 { subdir => 'config' },
51 { subdir => 'objects' },
52 { subdir => 'timeframe' },
53 ];
54
55 }});
56
57PMG::API2::ObjectGroupHelpers::register_delete_object_group_api(__PACKAGE__, 'when', '');
58PMG::API2::ObjectGroupHelpers::register_object_group_config_api(__PACKAGE__, 'when', 'config');
59PMG::API2::ObjectGroupHelpers::register_objects_api(__PACKAGE__, 'when', 'objects');
60
61PMG::RuleDB::TimeFrame->register_api(__PACKAGE__, 'timeframe');
62
631;