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:
Lukas Wagner 2024-11-08 15:41:18 +01:00 committed by Thomas Lamprecht
parent 88ddbd4b0a
commit d99b5f6eb9

View File

@ -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 $@;