VirtWeb/virtweb_backend/src/controllers/groups_controller.rs
Pierre HUBERT c908d00c62
All checks were successful
continuous-integration/drone/push Build is passing
Can get the list of groups
2024-11-02 17:44:10 +01:00

17 lines
520 B
Rust

use crate::controllers::{HttpResult, LibVirtReq};
use actix_web::HttpResponse;
/// Get the list of groups
pub async fn list(client: LibVirtReq) -> HttpResult {
let groups = match client.get_full_groups_list().await {
Err(e) => {
log::error!("Failed to get the list of groups! {e}");
return Ok(HttpResponse::InternalServerError()
.json(format!("Failed to get the list of groups! {e}")));
}
Ok(l) => l,
};
Ok(HttpResponse::Ok().json(groups))
}