pub struct X509Source { /* private fields */ }Expand description
Live source of X.509 SVIDs and bundles from the SPIFFE Workload API.
X509Source performs an initial sync before returning from X509Source::new.
Updates are applied atomically and can be observed via X509Source::updated.
Implementations§
Source§impl X509Source
impl X509Source
Sourcepub async fn new() -> Result<Arc<Self>, X509SourceError>
pub async fn new() -> Result<Arc<Self>, X509SourceError>
Creates an X509Source using the default Workload API endpoint.
The endpoint is resolved from SPIFFE_ENDPOINT_SOCKET. The source selects the default
X.509 SVID when multiple SVIDs are available.
On success, the returned source is already synchronized with the agent and will keep updating in the background until it is closed.
Sourcepub async fn shutdown(&self) -> Result<(), X509SourceError>
pub async fn shutdown(&self) -> Result<(), X509SourceError>
Cancels background tasks and waits for termination.
Sourcepub fn updated(&self) -> Receiver<u64>
pub fn updated(&self) -> Receiver<u64>
Returns a receiver that is notified on each successful update.
The received value is a monotonically increasing counter.
Sourcepub fn svid(&self) -> Result<X509Svid, X509SourceError>
pub fn svid(&self) -> Result<X509Svid, X509SourceError>
Returns the current X.509 SVID.
Source§impl X509Source
impl X509Source
Sourcepub fn bundle_set(&self) -> Result<X509BundleSet, X509SourceError>
pub fn bundle_set(&self) -> Result<X509BundleSet, X509SourceError>
Returns the current X.509 bundle set.
Sourcepub fn x509_context(&self) -> Result<X509Context, X509SourceError>
pub fn x509_context(&self) -> Result<X509Context, X509SourceError>
Returns the current X.509 context (SVID + bundles) as a single value.
Trait Implementations§
Source§impl BundleSource for X509Source
impl BundleSource for X509Source
Source§type Item = X509Bundle
type Item = X509Bundle
Source§fn get_bundle_for_trust_domain(
&self,
trust_domain: &TrustDomain,
) -> Result<Option<Self::Item>, Box<dyn StdError + Send + Sync + 'static>>
fn get_bundle_for_trust_domain( &self, trust_domain: &TrustDomain, ) -> Result<Option<Self::Item>, Box<dyn StdError + Send + Sync + 'static>>
TrustDomain.
If it cannot be found a bundle associated to the trust domain, it returns Ok(None).
If there’s is an error in source fetching the bundle, it returns an Err<Box<dyn Error + Send + Sync + 'static>>.Source§impl Debug for X509Source
impl Debug for X509Source
Source§impl Drop for X509Source
impl Drop for X509Source
Source§impl SvidSource for X509Source
impl SvidSource for X509Source
Source§fn get_svid(
&self,
) -> Result<Option<Self::Item>, Box<dyn StdError + Send + Sync + 'static>>
fn get_svid( &self, ) -> Result<Option<Self::Item>, Box<dyn StdError + Send + Sync + 'static>>
Ok(None).
If there’s is an error in source fetching the SVID, it returns an Err<Box<dyn Error + Send + Sync + 'static>>.Auto Trait Implementations§
impl !Freeze for X509Source
impl !RefUnwindSafe for X509Source
impl Send for X509Source
impl Sync for X509Source
impl Unpin for X509Source
impl !UnwindSafe for X509Source
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request