diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/planet.rs | 52 |
1 files changed, 52 insertions, 0 deletions
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)] |