Skip to main content

VimClient

Trait VimClient 

Source
pub trait VimClient: Send + Sync {
    // Required methods
    fn service_content(&self) -> &ServiceContent;
    fn get_request(&self, path: &str) -> RequestBuilder;
    fn post_json(&self, path: &str, payload: &dyn Serialize) -> RequestBuilder;
    fn post_bare(&self, path: &str) -> RequestBuilder;
    fn execute_bytes<'a>(
        &'a self,
        req: RequestBuilder,
    ) -> BoxFuture<'a, Result<Bytes>>;
    fn execute_option_bytes<'a>(
        &'a self,
        req: RequestBuilder,
    ) -> BoxFuture<'a, Result<Option<Bytes>>>;
    fn execute_void<'a>(
        &'a self,
        req: RequestBuilder,
    ) -> BoxFuture<'a, Result<()>>;
}
Expand description

Object-safe client abstraction for generated managed-object stubs (crate::mo::*).

This trait intentionally mirrors the subset of Client used by the generated bindings. It is object-safe so managed objects can store Arc<dyn VimClient>, enabling wrappers/mocks for testing and instrumentation.

Required Methods§

Source

fn service_content(&self) -> &ServiceContent

Access vSphere ServiceContent (root managed object references).

Source

fn get_request(&self, path: &str) -> RequestBuilder

Prepare GET request.

Source

fn post_json(&self, path: &str, payload: &dyn Serialize) -> RequestBuilder

Prepare POST request with a JSON payload.

Source

fn post_bare(&self, path: &str) -> RequestBuilder

Prepare POST request without a body.

Source

fn execute_bytes<'a>( &'a self, req: RequestBuilder, ) -> BoxFuture<'a, Result<Bytes>>

Execute a request and return the raw response body.

We return Bytes (not Vec<u8>) to avoid an extra copy of the response body.

Source

fn execute_option_bytes<'a>( &'a self, req: RequestBuilder, ) -> BoxFuture<'a, Result<Option<Bytes>>>

Execute a request and return an optional JSON value (empty body -> None).

Source

fn execute_void<'a>(&'a self, req: RequestBuilder) -> BoxFuture<'a, Result<()>>

Execute a request that returns no response body.

Implementors§