Files
pve-storage/PVE/API2/Storage/Replication.pm
Dietmar Maurer e0992d57e1 pvesr: rename list => jobs, call API
to avoid code duplication. I also removed the functioanlity to query
jobs on other nodes, because it is clumsy and not really needed.
2017-05-05 10:31:51 +02:00

66 lines
1.2 KiB
Perl

package PVE::API2::Storage::Replication;
use warnings;
use strict;
use PVE::JSONSchema qw(get_standard_option);
use PVE::ReplicationTools;
use PVE::RESTHandler;
use base qw(PVE::RESTHandler);
__PACKAGE__->register_method ({
name => 'index',
path => '',
method => 'GET',
permissions => { user => 'all' },
description => "Directory index.",
parameters => {
additionalProperties => 0,
properties => {
node => get_standard_option('pve-node'),
},
},
returns => {
type => 'array',
items => {
type => "object",
properties => {},
},
links => [ { rel => 'child', href => "{name}" } ],
},
code => sub {
my ($param) = @_;
return [
{ name => 'jobs' },
];
}});
__PACKAGE__->register_method ({
name => 'jobs',
path => 'jobs',
method => 'GET',
description => "List replication jobs.",
permissions => {
user => 'all',
},
protected => 1,
proxyto => 'node',
parameters => {
additionalProperties => 0,
properties => {
node => get_standard_option('pve-node'),
},
},
returns => { type => 'object' },
code => sub {
my ($param) = @_;
return PVE::ReplicationTools::get_all_jobs();
}});
1;