Skip to main content

Crate bes_canopy_api

Crate bes_canopy_api 

Source
Expand description

Rust client for canopy’s public API.

The wire types and the per-endpoint methods in schema are generated from canopy’s OpenAPI document, which lives in the same repository as this crate, so they are the types canopy declares rather than a separate description of them. The document and this crate carry the same version.

§Calling canopy

CanopyClient has one method per operation, taking and returning the generated types. The method name comes from the path (/backup-credentials becomes backup_credentials), with the verb prefixed where a path is served by more than one verb.

How a request reaches canopy is the consumer’s to decide: this crate depends on no HTTP client, and a consumer supplies a CanopyTransport which resolves the host, the scheme, and the authentication itself. Any status outside the success range surfaces as CanopyHttpError, since endpoints give particular statuses a meaning only the caller can read.

§What the generated types carry

Timestamp fields are jiff::Timestamp rather than text, and credential secrets are wrapped in Redacted so they stay out of Debug output and logs; read them through the inner value. Schemas that carry arbitrary further keys alongside their declared fields generate a map field holding the rest, so those keys can be both sent and read.

Generated structs are #[non_exhaustive] and carry a builder, so a schema gaining a field leaves construction working for a consumer that does not set it.

Re-exports§

pub use bytes;
pub use http;

Modules§

schema
Wire types and per-endpoint methods generated from canopy’s OpenAPI document.

Structs§

CanopyClient
Typed client for canopy’s public API.
CanopyHttpError
A non-2xx response from a canopy endpoint.
Redacted
Wraps a sensitive value so its Debug output doesn’t leak the contents.

Enums§

Error
Anything that can go wrong calling canopy.

Traits§

CanopyTransport
The HTTP transport a CanopyClient sends through.

Type Aliases§

CanopyRequest
A request built by CanopyClient, ready for a CanopyTransport to send.
CanopyResponse
A response handed back to CanopyClient by a CanopyTransport, with its body buffered.
Result
Result alias used throughout the crate.

Attribute Macros§

async_trait