]>
Commit | Line | Data |
---|---|---|
663510b8 WL |
1 | package PVE::API2::StorageReplication; |
2 | ||
3 | use warnings; | |
4 | use strict; | |
5 | ||
6 | use PVE::JSONSchema qw(get_standard_option); | |
7 | use PVE::ReplicationTools; | |
8 | ||
9 | use PVE::RESTHandler; | |
10 | ||
11 | use base qw(PVE::RESTHandler); | |
12 | ||
13 | __PACKAGE__->register_method ({ | |
14 | name => 'list', | |
15 | path => 'list', | |
16 | method => 'GET', | |
17 | description => "List of all replication jobs.", | |
18 | permissions => { | |
19 | user => 'all', | |
20 | }, | |
21 | protected => 1, | |
22 | proxyto => 'node', | |
23 | parameters => { | |
24 | additionalProperties => 0, | |
25 | properties => { | |
26 | node => get_standard_option('pve-node'), | |
27 | nodes => get_standard_option('pve-node-list' , | |
28 | {description => "Notes where the jobs is located.", | |
29 | optional => 1}), | |
30 | }, | |
31 | }, | |
32 | returns => { type => 'object' }, | |
33 | code => sub { | |
34 | my ($param) = @_; | |
35 | ||
36 | if ($param->{nodes}) { | |
37 | foreach my $node (PVE::Tools::split_list($param->{nodes})) { | |
38 | die "Node: $node does not exists.\n" if | |
39 | !PVE::Cluster::check_node_exists($node); | |
40 | } | |
41 | } | |
42 | ||
43 | my $nodes = $param->{nodes} ? | |
44 | $param->{nodes} : $param->{node}; | |
45 | ||
46 | return PVE::ReplicationTools::get_all_jobs($nodes); | |
47 | }}); | |
48 | ||
49 | 1; |