Skip to main content

Crate incus_client

Crate incus_client 

Source
Expand description

Async Rust client for the Incus REST API (system container and VM management).

This crate speaks to the Incus daemon over a local Unix domain socket only. Incus also supports a remote mutual-TLS HTTPS transport with a trust-on-first-use certificate model, but that surface is not implemented here — it’s tracked as a separate follow-up epic pending a real remote consumer, since a from-scratch TLS trust implementation carries real security risk that isn’t worth taking on speculatively.

Every operation-returning mutation surfaces a operations::Operation rather than assuming synchronous completion — see Client::wait_for_operation for the recommended way to wait for one to finish.

Unix-only: Incus itself only runs on Linux, and this crate’s transport is a Unix domain socket ([tokio::net::UnixStream]) with no cross-platform equivalent, so the entire crate compiles to nothing on non-Unix targets (Windows CI, for instance) rather than hard-failing the workspace build - there is no meaningful non-Unix version of a client for a Linux-only daemon.

Re-exports§

pub use config::ClientConfig;
pub use error::Error;
pub use error::Result;
pub use transport::Client;
pub use transport::WithEtag;

Modules§

config
error
events
WebSocket subscription to Incus’s /1.0/events push-notification stream. This is an enhancement over Client::wait_for_operation, not a replacement - that method works without this events feature at all.
operations
Async-operation lifecycle: every mutation Incus documents as long-running returns one of these, which callers wait on via Client::wait_for_operation rather than assuming synchronous completion.
resources
Resource CRUD surfaces. Each submodule owns one Incus resource type and is implemented independently against the stub files created here - instances in one pass, images/networks/storage/projects together in another, since they don’t share any files.
transport
The one place resource/operation code reaches the Incus daemon through: Client::request. Everything below this module is HTTP framing (transport::unix); everything above it (operations, resources) works only with IncusEnvelope, never raw bytes.