Unofficial Rust crate for interacting with the cloud-hypervisor REST API
The cloud-hypervisor-client crate can be used for managing the endpoints provided by a cloud-hypervisor socket in your
Rust project.
The API client code of this crate has been auto-generated from the OpenAPI description for the cloud-hypervisor REST API using OpenAPI Generator.
Add the crate to your project with Cargo:
cargo add cloud-hypervisor-clientOr add it to your Cargo.toml manually:
[dependencies]
cloud-hypervisor-client = "0.4"The crate targets a local cloud-hypervisor VMM over a Unix domain socket via hyper and hyperlocal, so it
only works on Unix-like systems.
A very basic example for listing all existing servers:
use cloud_hypervisor_client::apis::DefaultApi;
use cloud_hypervisor_client::socket_based_api_client;
#[tokio::main]
async fn main() -> Result<(), String> {
let client = socket_based_api_client("cloud_hypervisor_vm_socket.sock");
let vm_info = client
.vm_info_get()
.await
.map_err(|err| format!("API call to vm_info_get failed: {:?}", err))?;
println!("Received vm info: {vm_info:?}");
Ok(())
}For more examples check out the examples folder in the Git repository.
This crate's MSRV is 1.86.0.
This crate was based on the great work done in: https://github.com/HenningHolmDE/hcloud-rust.