Ready to implement network routes contents

This commit is contained in:
2023-12-04 20:16:32 +01:00
parent 0e3945089c
commit e579a3aadd
16 changed files with 523 additions and 46 deletions

View File

@ -116,4 +116,31 @@ impl LibVirtClient {
pub async fn delete_network(&self, id: XMLUuid) -> anyhow::Result<()> {
self.0.send(libvirt_actor::DeleteNetwork(id)).await?
}
/// Get auto-start status of a network
pub async fn is_network_autostart(&self, id: XMLUuid) -> anyhow::Result<bool> {
self.0.send(libvirt_actor::IsNetworkAutostart(id)).await?
}
/// Update autostart value of a network
pub async fn set_network_autostart(&self, id: XMLUuid, autostart: bool) -> anyhow::Result<()> {
self.0
.send(libvirt_actor::SetNetworkAutostart(id, autostart))
.await?
}
/// Check out whether a network is started or not
pub async fn is_network_started(&self, id: XMLUuid) -> anyhow::Result<bool> {
self.0.send(libvirt_actor::IsNetworkStarted(id)).await?
}
/// Start a network
pub async fn start_network(&self, id: XMLUuid) -> anyhow::Result<()> {
self.0.send(libvirt_actor::StartNetwork(id)).await?
}
/// Stop a network
pub async fn stop_network(&self, id: XMLUuid) -> anyhow::Result<()> {
self.0.send(libvirt_actor::StopNetwork(id)).await?
}
}