]>
git.proxmox.com Git - pve-storage.git/blob - PVE/API2/Storage/Replication.pm
1 package PVE
::API2
::Storage
::Replication
;
6 use PVE
::JSONSchema
qw(get_standard_option);
7 use PVE
::RPCEnvironment
;
8 use PVE
::ReplicationTools
;
12 use base
qw(PVE::RESTHandler);
14 __PACKAGE__-
>register_method ({
18 permissions
=> { user
=> 'all' },
19 description
=> "Directory index.",
21 additionalProperties
=> 0,
23 node
=> get_standard_option
('pve-node'),
32 links
=> [ { rel
=> 'child', href
=> "{name}" } ],
43 __PACKAGE__-
>register_method ({
47 description
=> "List replication jobs.",
49 description
=> "Only list jobs where you have VM.Audit permissons on /vms/<vmid>.",
55 additionalProperties
=> 0,
57 node
=> get_standard_option
('pve-node'),
66 links
=> [ { rel
=> 'child', href
=> "{vmid}" } ],
71 my $rpcenv = PVE
::RPCEnvironment
::get
();
72 my $authuser = $rpcenv->get_user();
74 my $jobs = PVE
::ReplicationTools
::get_all_jobs
();
77 foreach my $vmid (sort keys %$jobs) {
78 next if !$rpcenv->check($authuser, "/vms/$vmid", [ 'VM.Audit' ]);
79 my $job = $jobs->{$vmid};
87 __PACKAGE__-
>register_method ({
88 name
=> 'destroy_job',
91 description
=> "Destroy replication job.",
93 check
=> ['perm', '/vms/{vmid}', ['VM.Config.Disk']],
97 additionalProperties
=> 0,
100 description
=> "The VMID of the guest.",
101 type
=> 'string', format
=> 'pve-vmid',
105 returns
=> { type
=> 'null' },
109 PVE
::ReplicationTools
::destroy_replica
($param->{vmid
});