pub struct ApiKeyCredentialBuilder { /* private fields */ }Expand description
Configures validation, HTTP transport, and the first API-key exchange.
Obtain this from ApiKeyCredential::builder. The default timeout is ten seconds and covers
connecting and receiving the response. An injected HTTP client can configure proxies or test
transport. Redirects are disabled when the client is built.
Implementations§
Source§impl ApiKeyCredentialBuilder
impl ApiKeyCredentialBuilder
Sourcepub fn exchange_timeout(self, exchange_timeout: Duration) -> Self
pub fn exchange_timeout(self, exchange_timeout: Duration) -> Self
Sets the maximum duration of each exchange, including connection and response.
The default is ten seconds. A zero timeout is rejected by Self::build. The timeout
also bounds waiting for a fresh token after Dex rejects a unary call.
Sourcepub fn http_client(self, http_client: ClientBuilder) -> Self
pub fn http_client(self, http_client: ClientBuilder) -> Self
Configures the HTTP client for token exchange.
This supports proxy settings and test transport. Redirects are always disabled so the API key is never sent to a redirect target. Each request uses the exchange timeout.
Sourcepub async fn build(self) -> Result<ApiKeyCredential, ApiKeyCredentialError>
pub async fn build(self) -> Result<ApiKeyCredential, ApiKeyCredentialError>
Validates settings, exchanges the key once, and starts automatic refresh.
The URL must use HTTPS, except localhost, IPv4 loopback addresses, and ::1 may use
HTTP. The server ID is supplied by the application and is never inferred from the URL.
This must run inside a Tokio runtime. No background task remains if the initial exchange
fails. See ApiKeyCredential for a complete example and lifecycle details.
§Errors
Returns ApiKeyCredentialError for an empty value, invalid or disallowed URL, zero
timeout, HTTP client setup failure, transport failure, timeout, rejected HTTP status, or
malformed response. The error names the URL and status without exposing secrets.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ApiKeyCredentialBuilder
impl !UnwindSafe for ApiKeyCredentialBuilder
impl Forget for ApiKeyCredentialBuilder
impl Freeze for ApiKeyCredentialBuilder
impl Send for ApiKeyCredentialBuilder
impl Sync for ApiKeyCredentialBuilder
impl Unpin for ApiKeyCredentialBuilder
impl UnsafeUnpin for ApiKeyCredentialBuilder
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
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