pub struct DelegatedIdentityClient { /* private fields */ }Expand description
Impl for DelegatedIdentity API
Implementations§
Source§impl DelegatedIdentityClient
Constructors
impl DelegatedIdentityClient
Constructors
Sourcepub async fn connect_to(
endpoint: impl AsRef<str>,
) -> Result<Self, DelegatedIdentityError>
pub async fn connect_to( endpoint: impl AsRef<str>, ) -> Result<Self, DelegatedIdentityError>
Create a client by connecting to the given admin endpoint URI string (e.g. unix:///...).
§Arguments
endpoint- The path to the UNIX domain socket, which can optionally start with “unix:”.
§Returns
Result<Self, DelegatedIdentityError>- Returns an instance ofDelegatedIdentityClientif successful, otherwise returns an error.
§Errors
This function will return an error if the provided socket path is invalid or if there are issues connecting.
Sourcepub async fn connect_env() -> Result<Self, DelegatedIdentityError>
pub async fn connect_env() -> Result<Self, DelegatedIdentityError>
Creates a new DelegatedIdentityClient using the default socket endpoint address.
Requires that the environment variable SPIFFE_ENDPOINT_SOCKET be set with
the path to the Workload API endpoint socket.
§Errors
The function returns a variant of DelegatedIdentityError if environment variable is not set or if
the provided socket path is not valid.
Sourcepub async fn connect(endpoint: Endpoint) -> Result<Self, DelegatedIdentityError>
pub async fn connect(endpoint: Endpoint) -> Result<Self, DelegatedIdentityError>
Sourcepub fn new(conn: Channel) -> Result<Self, DelegatedIdentityError>
pub fn new(conn: Channel) -> Result<Self, DelegatedIdentityError>
Creates a new DelegatedIdentityClient from an established gRPC channel.
This constructor does not perform any network I/O. It only wraps the
provided tonic::transport::Channel and prepares the client for use.
§Errors
Returns DelegatedIdentityError if the client could not be constructed from
the provided channel (for example, due to an invalid configuration).
Source§impl DelegatedIdentityClient
impl DelegatedIdentityClient
Sourcepub async fn fetch_x509_svid(
&self,
attest_type: DelegateAttestationRequest,
) -> Result<X509Svid, DelegatedIdentityError>
pub async fn fetch_x509_svid( &self, attest_type: DelegateAttestationRequest, ) -> Result<X509Svid, DelegatedIdentityError>
Fetches a single X509 SPIFFE Verifiable Identity Document (SVID).
This method connects to the SPIFFE Workload API and returns the first X509 SVID in the response.
§Arguments
selectors- A list of selectors to filter the stream ofX509Svidupdates.
§Returns
On success, it returns a valid X509Svid which represents the parsed SVID.
If the fetch operation or the parsing fails, it returns a DelegatedIdentityError.
§Errors
Returns DelegatedIdentityError if the gRPC call fails or if the SVID could not be parsed from the gRPC response.
Sourcepub async fn stream_x509_svids(
&self,
attest_type: DelegateAttestationRequest,
) -> Result<impl Stream<Item = Result<X509Svid, DelegatedIdentityError>> + Send + '_, DelegatedIdentityError>
pub async fn stream_x509_svids( &self, attest_type: DelegateAttestationRequest, ) -> Result<impl Stream<Item = Result<X509Svid, DelegatedIdentityError>> + Send + '_, DelegatedIdentityError>
Watches the stream of X509Svid updates.
This function establishes a stream with the Workload API to continuously receive updates for the X509Svid.
The returned stream can be used to asynchronously yield new X509Svid updates as they become available.
§Arguments
selectors- A list of selectors to filter the stream ofX509Svidupdates.
§Returns
Returns a stream of Result<X509Svid, DelegatedIdentityError>. Each item represents an updated X509Svid or an error if
there was a problem processing an update from the stream.
§Errors
The function can return an error variant of DelegatedIdentityError in the following scenarios:
- There’s an issue connecting to the Workload API.
- An error occurs while setting up the stream.
Individual stream items might also be errors if there’s an issue processing the response for a specific update.
Sourcepub async fn fetch_x509_bundles(
&self,
) -> Result<X509BundleSet, DelegatedIdentityError>
pub async fn fetch_x509_bundles( &self, ) -> Result<X509BundleSet, DelegatedIdentityError>
Fetches X509BundleSet, that is a set of X509Bundle keyed by the trust domain to which they belong.
§Errors
The function returns a variant of DelegatedIdentityError if there is an error connecting to the Workload API or
there is a problem processing the response.
Sourcepub async fn stream_x509_bundles(
&self,
) -> Result<impl Stream<Item = Result<X509BundleSet, DelegatedIdentityError>> + Send + 'static, DelegatedIdentityError>
pub async fn stream_x509_bundles( &self, ) -> Result<impl Stream<Item = Result<X509BundleSet, DelegatedIdentityError>> + Send + 'static, DelegatedIdentityError>
Watches the stream of X509Bundle updates.
This function establishes a stream with the Workload API to continuously receive updates for the X509Bundle.
The returned stream can be used to asynchronously yield new X509Bundle updates as they become available.
§Returns
Returns a stream of Result<X509BundleSet, DelegatedIdentityError>. Each item represents an updated X509BundleSet or an error if
there was a problem processing an update from the stream.
§Errors
The function can return an error variant of DelegatedIdentityError in the following scenarios:
- There’s an issue connecting to the Admin API.
- An error occurs while setting up the stream.
Individual stream items might also be errors if there’s an issue processing the response for a specific update.
Sourcepub async fn fetch_jwt_svids<T: AsRef<str> + ToString>(
&self,
audience: &[T],
attest_type: DelegateAttestationRequest,
) -> Result<Vec<JwtSvid>, DelegatedIdentityError>
pub async fn fetch_jwt_svids<T: AsRef<str> + ToString>( &self, audience: &[T], attest_type: DelegateAttestationRequest, ) -> Result<Vec<JwtSvid>, DelegatedIdentityError>
Fetches a list of JwtSvid parsing the JWT token in the Workload API response, for the given audience and selectors.
§Arguments
audience- A list of audiences to include in the JWT token. Cannot be empty nor contain only empty strings.selectors- A list of selectors to filter the list ofJwtSvid.
§Errors
The function returns a variant of DelegatedIdentityError if there is an error connecting to the Workload API or
there is a problem processing the response.
Sourcepub async fn stream_jwt_bundles(
&self,
) -> Result<impl Stream<Item = Result<JwtBundleSet, DelegatedIdentityError>> + Send + 'static, DelegatedIdentityError>
pub async fn stream_jwt_bundles( &self, ) -> Result<impl Stream<Item = Result<JwtBundleSet, DelegatedIdentityError>> + Send + 'static, DelegatedIdentityError>
Watches the stream of JwtBundleSet updates.
This function establishes a stream with the Workload API to continuously receive updates for the JwtBundleSet.
The returned stream can be used to asynchronously yield new JwtBundleSet updates as they become available.
§Returns
Returns a stream of Result<JwtBundleSet, DelegatedIdentityError>. Each item represents an updated JwtBundleSet or an error if
there was a problem processing an update from the stream.
§Errors
The function can return an error variant of DelegatedIdentityError in the following scenarios:
- There’s an issue connecting to the Workload API.
- An error occurs while setting up the stream.
Individual stream items might also be errors if there’s an issue processing the response for a specific update.
Sourcepub async fn fetch_jwt_bundles(
&self,
) -> Result<JwtBundleSet, DelegatedIdentityError>
pub async fn fetch_jwt_bundles( &self, ) -> Result<JwtBundleSet, DelegatedIdentityError>
Fetches JwtBundleSet that is a set of JwtBundle keyed by the trust domain to which they belong.
§Errors
The function returns a variant of DelegatedIdentityError if there is an error connecting to the Workload API or
there is a problem processing the response.
Trait Implementations§
Source§impl Clone for DelegatedIdentityClient
impl Clone for DelegatedIdentityClient
Source§fn clone(&self) -> DelegatedIdentityClient
fn clone(&self) -> DelegatedIdentityClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for DelegatedIdentityClient
impl !RefUnwindSafe for DelegatedIdentityClient
impl Send for DelegatedIdentityClient
impl Sync for DelegatedIdentityClient
impl Unpin for DelegatedIdentityClient
impl !UnwindSafe for DelegatedIdentityClient
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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