Implement routes to shutdown, kill, reset, suspend, resume and take screenshot of VMs of a group
This commit is contained in:
@@ -389,6 +389,52 @@ pub async fn group_vm_start(
|
||||
json_request(id.route_vm_start(vm_id)).await
|
||||
}
|
||||
|
||||
/// Shutdown one or all VMs of a group
|
||||
pub async fn group_vm_shutdown(
|
||||
id: &GroupID,
|
||||
vm_id: Option<VMUuid>,
|
||||
) -> anyhow::Result<TreatmentResult> {
|
||||
json_request(id.route_vm_shutdown(vm_id)).await
|
||||
}
|
||||
|
||||
/// Kill one or all VMs of a group
|
||||
pub async fn group_vm_kill(id: &GroupID, vm_id: Option<VMUuid>) -> anyhow::Result<TreatmentResult> {
|
||||
json_request(id.route_vm_kill(vm_id)).await
|
||||
}
|
||||
|
||||
/// Reset one or all VMs of a group
|
||||
pub async fn group_vm_reset(
|
||||
id: &GroupID,
|
||||
vm_id: Option<VMUuid>,
|
||||
) -> anyhow::Result<TreatmentResult> {
|
||||
json_request(id.route_vm_reset(vm_id)).await
|
||||
}
|
||||
|
||||
/// Suspend one or all VMs of a group
|
||||
pub async fn group_vm_suspend(
|
||||
id: &GroupID,
|
||||
vm_id: Option<VMUuid>,
|
||||
) -> anyhow::Result<TreatmentResult> {
|
||||
json_request(id.route_vm_suspend(vm_id)).await
|
||||
}
|
||||
|
||||
/// Resume one or all VMs of a group
|
||||
pub async fn group_vm_resume(
|
||||
id: &GroupID,
|
||||
vm_id: Option<VMUuid>,
|
||||
) -> anyhow::Result<TreatmentResult> {
|
||||
json_request(id.route_vm_resume(vm_id)).await
|
||||
}
|
||||
|
||||
/// Get the screenshot of one or all VMs of a group
|
||||
pub async fn group_vm_screenshot(id: &GroupID, vm_id: Option<VMUuid>) -> anyhow::Result<Vec<u8>> {
|
||||
Ok(request(id.route_vm_screenshot(vm_id))
|
||||
.await?
|
||||
.bytes()
|
||||
.await?
|
||||
.to_vec())
|
||||
}
|
||||
|
||||
/// Get current server information
|
||||
pub async fn get_server_info() -> anyhow::Result<SystemInfo> {
|
||||
json_request("/api/server/info").await
|
||||
|
||||
Reference in New Issue
Block a user