Can update and delete networks
This commit is contained in:
		@@ -40,3 +40,23 @@ pub async fn get_single(client: LibVirtReq, req: web::Path<NetworkID>) -> HttpRe
 | 
			
		||||
 | 
			
		||||
    Ok(HttpResponse::Ok().json(network))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Update the information about a single network
 | 
			
		||||
pub async fn update(
 | 
			
		||||
    client: LibVirtReq,
 | 
			
		||||
    path: web::Path<NetworkID>,
 | 
			
		||||
    body: web::Json<NetworkInfo>,
 | 
			
		||||
) -> HttpResult {
 | 
			
		||||
    let mut network = body.0.to_virt_network()?;
 | 
			
		||||
    network.uuid = Some(path.uid);
 | 
			
		||||
    client.update_network(network).await?;
 | 
			
		||||
 | 
			
		||||
    Ok(HttpResponse::Ok().json("Network updated"))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Delete a network
 | 
			
		||||
pub async fn delete(client: LibVirtReq, path: web::Path<NetworkID>) -> HttpResult {
 | 
			
		||||
    client.delete_network(path.uid).await?;
 | 
			
		||||
 | 
			
		||||
    Ok(HttpResponse::Ok().json("Network deleted"))
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user