mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-10-04 21:10:03 +00:00
api: notifications: use get_targets impl from proxmox-notify
The get_targets API endpoint is now implemented in Rust. Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> Tested-By: Stefan Hanreich <s.hanreich@proxmox.com>
This commit is contained in:
parent
88ddbd4b0a
commit
d99b5f6eb9
@ -309,39 +309,7 @@ __PACKAGE__->register_method ({
|
|||||||
my $config = PVE::Notify::read_config();
|
my $config = PVE::Notify::read_config();
|
||||||
|
|
||||||
my $targets = eval {
|
my $targets = eval {
|
||||||
my $result = [];
|
$config->get_targets();
|
||||||
|
|
||||||
for my $target (@{$config->get_sendmail_endpoints()}) {
|
|
||||||
push @$result, {
|
|
||||||
name => $target->{name},
|
|
||||||
comment => $target->{comment},
|
|
||||||
type => 'sendmail',
|
|
||||||
disable => $target->{disable},
|
|
||||||
origin => $target->{origin},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $target (@{$config->get_gotify_endpoints()}) {
|
|
||||||
push @$result, {
|
|
||||||
name => $target->{name},
|
|
||||||
comment => $target->{comment},
|
|
||||||
type => 'gotify',
|
|
||||||
disable => $target->{disable},
|
|
||||||
origin => $target->{origin},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $target (@{$config->get_smtp_endpoints()}) {
|
|
||||||
push @$result, {
|
|
||||||
name => $target->{name},
|
|
||||||
comment => $target->{comment},
|
|
||||||
type => 'smtp',
|
|
||||||
disable => $target->{disable},
|
|
||||||
origin => $target->{origin},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
$result
|
|
||||||
};
|
};
|
||||||
|
|
||||||
raise_api_error($@) if $@;
|
raise_api_error($@) if $@;
|
||||||
|
Loading…
Reference in New Issue
Block a user