Parse NW filters XML structure
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
use crate::actors::libvirt_actor;
|
||||
use crate::actors::libvirt_actor::LibVirtActor;
|
||||
use crate::libvirt_lib_structures::{DomainState, DomainXML, NetworkXML, XMLUuid};
|
||||
use crate::libvirt_lib_structures::{
|
||||
DomainState, DomainXML, NetworkFilterXML, NetworkXML, XMLUuid,
|
||||
};
|
||||
use crate::libvirt_rest_structures::{HypervisorInfo, NetworkInfo, VMInfo};
|
||||
use actix::Addr;
|
||||
|
||||
@ -165,4 +167,19 @@ impl LibVirtClient {
|
||||
pub async fn stop_network(&self, id: XMLUuid) -> anyhow::Result<()> {
|
||||
self.0.send(libvirt_actor::StopNetwork(id)).await?
|
||||
}
|
||||
|
||||
/// Get the full list of network filters
|
||||
pub async fn get_full_network_filters_list(&self) -> anyhow::Result<Vec<NetworkFilterXML>> {
|
||||
let ids = self.0.send(libvirt_actor::GetNWFiltersListReq).await??;
|
||||
let mut info = Vec::with_capacity(ids.len());
|
||||
for id in ids {
|
||||
info.push(self.get_single_network_filter(id).await?)
|
||||
}
|
||||
Ok(info)
|
||||
}
|
||||
|
||||
/// Get the information about a single domain
|
||||
pub async fn get_single_network_filter(&self, id: XMLUuid) -> anyhow::Result<NetworkFilterXML> {
|
||||
self.0.send(libvirt_actor::GetNWFilterXMLReq(id)).await?
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user