diff options
Diffstat (limited to 'src/handlers')
-rw-r--r-- | src/handlers/planets.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/handlers/planets.rs b/src/handlers/planets.rs index ede7b2b..06773bc 100644 --- a/src/handlers/planets.rs +++ b/src/handlers/planets.rs @@ -76,3 +76,27 @@ pub async fn reboot(Path(uuid): Path<String>) -> NoneResult { Ok(()) } + +pub async fn force_reboot(Path(uuid): Path<String>) -> NoneResult { + let mut s = get_star()?; + + if let Ok(p) = s.find_planet(uuid) { + p.hard_reboot()?; + } else { + return Err(ServiceError::NotFound); + } + + Ok(()) +} + +pub async fn force_shutdown(Path(uuid): Path<String>) -> NoneResult { + let mut s = get_star()?; + + if let Ok(p) = s.find_planet(uuid) { + p.hard_shutdown()?; + } else { + return Err(ServiceError::NotFound); + } + + Ok(()) +} |