pub struct WorkloadApiClient { /* private fields */ }Expand description
A Workload API client that manages SVID lifecycle.
In SPIFFE/SPIRE deployments, workloads fetch SVIDs from the local SPIRE agent over a Unix domain socket. This client tracks the current SVID(s) and handles rotation.
Implementations§
Source§impl WorkloadApiClient
impl WorkloadApiClient
Sourcepub fn new(config: WorkloadApiConfig) -> Self
pub fn new(config: WorkloadApiConfig) -> Self
Create a new Workload API client.
Sourcepub fn rotation_interval(&self) -> Duration
pub fn rotation_interval(&self) -> Duration
Return the rotation interval.
Sourcepub async fn store_x509_svid(&self, svid: SvidResponse)
pub async fn store_x509_svid(&self, svid: SvidResponse)
Store an X.509-SVID (e.g., after receiving it from the Workload API).
Sourcepub async fn store_jwt_svid(&self, svid: SvidResponse)
pub async fn store_jwt_svid(&self, svid: SvidResponse)
Store a JWT-SVID.
Sourcepub async fn get_x509_svid(&self, spiffe_id: &str) -> Option<SvidResponse>
pub async fn get_x509_svid(&self, spiffe_id: &str) -> Option<SvidResponse>
Get the current X.509-SVID for a given SPIFFE ID.
Sourcepub async fn get_jwt_svid(&self, spiffe_id: &str) -> Option<SvidResponse>
pub async fn get_jwt_svid(&self, spiffe_id: &str) -> Option<SvidResponse>
Get the current JWT-SVID for a given SPIFFE ID.
Sourcepub async fn get_bundle(&self, trust_domain: &str) -> Option<Vec<Vec<u8>>>
pub async fn get_bundle(&self, trust_domain: &str) -> Option<Vec<Vec<u8>>>
Get the trust bundle for a given trust domain.
Sourcepub async fn needs_rotation(&self) -> Vec<String>
pub async fn needs_rotation(&self) -> Vec<String>
Check if any X.509-SVID needs rotation (within 20% of expiry window).
Sourcepub async fn cleanup_expired(&self)
pub async fn cleanup_expired(&self)
Remove expired SVIDs.
Sourcepub async fn x509_count(&self) -> usize
pub async fn x509_count(&self) -> usize
Number of stored X.509-SVIDs.
Auto Trait Implementations§
impl Freeze for WorkloadApiClient
impl !RefUnwindSafe for WorkloadApiClient
impl Send for WorkloadApiClient
impl Sync for WorkloadApiClient
impl Unpin for WorkloadApiClient
impl UnsafeUnpin for WorkloadApiClient
impl !UnwindSafe for WorkloadApiClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more