#rest #cloud-hypervisor

cloud-hypervisor-client

Unofficial Rust crate for accessing the cloud-hypervisor REST API

4 releases

0.3.3 Jun 20, 2025
0.3.2 Jun 16, 2025
0.3.1 Jun 12, 2025
0.3.0 Apr 11, 2025

#507 in HTTP server

Download history 65/week @ 2025-08-17 16/week @ 2025-08-24 50/week @ 2025-08-31 67/week @ 2025-09-07 352/week @ 2025-09-14 1679/week @ 2025-09-21 908/week @ 2025-09-28 943/week @ 2025-10-05 887/week @ 2025-10-12 1001/week @ 2025-10-19 1135/week @ 2025-10-26 1413/week @ 2025-11-02 938/week @ 2025-11-09 1888/week @ 2025-11-16 1005/week @ 2025-11-23 495/week @ 2025-11-30

4,327 downloads per month

MIT/Apache

93KB
2K SLoC

cloud-hypervisor-client

Unofficial Rust crate for interacting with the cloud-hypervisor REST API

Overview

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.

Example

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.

Selecting a TLS implementation

The underlying TLS implementation for reqwest can be selected using Cargo features:

  • default-tls (enabled by default): Provides TLS support to connect over HTTPS.
  • native-tls: Enables TLS functionality provided by native-tls.
  • native-tls-vendored: Enables the vendored feature of native-tls.
  • rustls-tls: Enables TLS functionality provided by rustls.

(Refer to Optional Features in the reqwest documentation.)

Example for using the TLS functionality provided by rustls:

[dependencies]
cloud_hypervisor_client = { version = "0.3.0", default-features = false, features = ["rustls-tls"] }

Attributions

This crate was based on the great work done in: https://github.com/HenningHolmDE/hcloud-rust.

Dependencies

~10–24MB
~287K SLoC