Expand description
Workload API client for fetching SPIFFE X.509 and JWT material.
WorkloadApiClient provides one-shot RPCs (fetch SVIDs/bundles) and streaming RPCs for
receiving updates as material rotates.
Most users should prefer higher-level types like X509Source, which handle reconnection and
provide an always-up-to-date view of the X.509 context.
§Example
use spiffe::{SpiffeId, WorkloadApiClient};
use tokio_stream::StreamExt;
let mut client =
WorkloadApiClient::new_from_path("unix:/tmp/spire-agent/public/api.sock").await?;
let jwt = client.fetch_jwt_token(&["service1"], None).await?;
let _jwt_svid = client.fetch_jwt_svid(&["service1"], None).await?;
let _jwt_bundles = client.fetch_jwt_bundles().await?;
let _x509_svid = client.fetch_x509_svid().await?;
let _x509_bundles = client.fetch_x509_bundles().await?;
let _x509_ctx = client.fetch_x509_context().await?;
let mut updates = client.stream_x509_contexts().await?;
while let Some(update) = updates.next().await {
let _ctx = update?;
}Structs§
- Workload
ApiClient - Client for the SPIFFE Workload API.