[pve-devel] [PATCH proxmox 07/19] notify: api: add get_targets

Lukas Wagner l.wagner at proxmox.com
Fri Apr 19 14:54:24 CEST 2024



On  2024-04-19 10:34, Fiona Ebner wrote:
> Am 09.04.24 um 15:25 schrieb Lukas Wagner:
>> +/// Get a list of all notification targets.
>> +pub fn get_targets(config: &Config) -> Result<Vec<Target>, HttpError> {
>> +    let mut targets = Vec::new();
>> +
>> +    #[cfg(feature = "gotify")]
>> +    for endpoint in gotify::get_endpoints(config)? {
>> +        targets.push(Target {
>> +            name: endpoint.name,
>> +            origin: endpoint.origin.unwrap_or(Origin::UserCreated),
>> +            endpoint_type: EndpointType::Gotify,
>> +            disable: endpoint.disable,
>> +            comment: endpoint.comment,
>> +        })
> 
> Would it make sense to have into() functions for
> {Gotify,Sendmail,Smtp}Config -> Target ?

That would indeed be a bit nicer - but I'll do that in a follow-up, since this is
completely internal to proxmox-notify and is more 'style' than an actual issue :)

Thanks!

-- 
- Lukas




More information about the pve-devel mailing list