Skip to main content

Crate cloud_hypervisor_client

Crate cloud_hypervisor_client 

Source
Expand description

Unofficial Rust crate for accessing the cloud-hypervisor REST API

§Overview

The cloud-hypervisor-client crate can be used for managing the endpoints provided by the cloud-hypervisor REST API socket in your Rust project.

The API client code of this crate has been auto-generated from the Official OpenAPI Description for the cloud-hypervisor REST API using OpenAPI Generator.

§Example

Get information about a VM:

 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.

Modules§

apis
models

Functions§

socket_based_api_client
Builds a client for the cloud-hypervisor REST API exposed at the given Unix domain socket path.

Type Aliases§

SocketBasedApiClient
A DefaultApiClient wired up to talk to the cloud-hypervisor VMM over a Unix domain socket.