diff options
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/planet.rs | 52 |
2 files changed, 53 insertions, 1 deletions
@@ -1,6 +1,6 @@ [package] name = "solarlib" -version = "1.4.0" +version = "1.4.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/planet.rs b/src/planet.rs index 210de5a..be81e7e 100644 --- a/src/planet.rs +++ b/src/planet.rs @@ -244,6 +244,58 @@ impl Planet { d.suspend()?; Ok(()) } + + pub fn resume(&self) -> Result<(), Error> { + let d = match &self.domain { + Some(d) => d, + None => { + return Err(Error::Other(String::from("No domain connection found"))); + } + }; + + d.resume()?; + Ok(()) + } + + pub fn reboot(&self) -> Result<(), Error> { + let d = match &self.domain { + Some(d) => d, + None => { + return Err(Error::Other(String::from("No domain connection found"))); + }, + }; + + d.reboot(0)?; + + Ok(()) + } + + pub fn hard_shutdown(&self) -> Result<(), Error> { + let d = match &self.domain { + Some(d) => d, + None => { + return Err(Error::Other(String::from("No domain connection found"))); + } + }; + + d.destroy()?; + + Ok(()) + } + + pub fn hard_reboot(&self) -> Result<(), Error> { + let d = match &self.domain { + Some(d) => d, + None => { + return Err(Error::Other(String::from("No domain connection found"))); + } + }; + + d.destroy()?; + d.create()?; + + Ok(()) + } } #[cfg(test)] |