Add REST route to get networks list
This commit is contained in:
@ -14,7 +14,7 @@ impl LibVirtClient {
|
||||
}
|
||||
|
||||
/// Get the full list of domain
|
||||
pub async fn get_full_list(&self) -> anyhow::Result<Vec<DomainXML>> {
|
||||
pub async fn get_full_domains_list(&self) -> anyhow::Result<Vec<DomainXML>> {
|
||||
let ids = self.0.send(libvirt_actor::GetDomainsListReq).await??;
|
||||
let mut info = Vec::with_capacity(ids.len());
|
||||
for id in ids {
|
||||
@ -96,4 +96,19 @@ impl LibVirtClient {
|
||||
pub async fn update_network(&self, network: NetworkXML) -> anyhow::Result<XMLUuid> {
|
||||
self.0.send(libvirt_actor::DefineNetwork(network)).await?
|
||||
}
|
||||
|
||||
/// Get the full list of networks
|
||||
pub async fn get_full_networks_list(&self) -> anyhow::Result<Vec<NetworkXML>> {
|
||||
let ids = self.0.send(libvirt_actor::GetNetworksListReq).await??;
|
||||
let mut info = Vec::with_capacity(ids.len());
|
||||
for id in ids {
|
||||
info.push(self.get_single_network(id).await?)
|
||||
}
|
||||
Ok(info)
|
||||
}
|
||||
|
||||
/// Get the information about a single network
|
||||
pub async fn get_single_network(&self, id: XMLUuid) -> anyhow::Result<NetworkXML> {
|
||||
self.0.send(libvirt_actor::GetNetworkXMLReq(id)).await?
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user