17 lines
520 B
Rust
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))
|
||
|
}
|