pub struct BrokerClient { /* private fields */ }Expand description
Broker API client for programmatic credential requests.
Implementations§
Source§impl BrokerClient
impl BrokerClient
pub fn new(config: BrokerConfig) -> Self
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create from environment variables. Reads AUDEX_BROKER_URL and AUDEX_BROKER_API_KEY.
Sourcepub async fn get_credentials(
&self,
request: &CredentialRequest,
) -> Result<CredentialResponse>
pub async fn get_credentials( &self, request: &CredentialRequest, ) -> Result<CredentialResponse>
Request scoped credentials from the broker.
Sourcepub async fn get_credentials_simple(
&self,
allow: &str,
ttl: &str,
) -> Result<CredentialResponse>
pub async fn get_credentials_simple( &self, allow: &str, ttl: &str, ) -> Result<CredentialResponse>
Request credentials with simple parameters (convenience method).
Sourcepub async fn batch_credentials(
&self,
requests: Vec<CredentialRequest>,
) -> Result<BatchCredentialResponse>
pub async fn batch_credentials( &self, requests: Vec<CredentialRequest>, ) -> Result<BatchCredentialResponse>
Batch request — issue multiple credentials in one API call.
Sourcepub async fn create_token(
&self,
request: &CredentialRequest,
) -> Result<BrokerToken>
pub async fn create_token( &self, request: &CredentialRequest, ) -> Result<BrokerToken>
Create a broker token — a single-use token that can be exchanged for credentials. Useful for passing to untrusted subprocesses.
Sourcepub async fn exchange_token(&self, token: &str) -> Result<CredentialResponse>
pub async fn exchange_token(&self, token: &str) -> Result<CredentialResponse>
Exchange a broker token for credentials.
Sourcepub async fn revoke(&self, session_id: &str, reason: Option<&str>) -> Result<()>
pub async fn revoke(&self, session_id: &str, reason: Option<&str>) -> Result<()>
Revoke a session’s credentials.
Sourcepub async fn list_sessions(&self) -> Result<String>
pub async fn list_sessions(&self) -> Result<String>
List active sessions from the broker.
Auto Trait Implementations§
impl Freeze for BrokerClient
impl RefUnwindSafe for BrokerClient
impl Send for BrokerClient
impl Sync for BrokerClient
impl Unpin for BrokerClient
impl UnsafeUnpin for BrokerClient
impl UnwindSafe for BrokerClient
Blanket Implementations§
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 moreCreates a shared type from an unshared type.