pub struct Credential {
pub secret: String,
pub expires_at_ms: Option<u64>,
pub headers: Vec<(String, String)>,
pub base_url: Option<String>,
}Expand description
A credential to authenticate one request.
Fields§
§secret: StringThe secret sent to the provider (API key or bearer token).
expires_at_ms: Option<u64>Absolute expiry in Unix milliseconds, when known.
headers: Vec<(String, String)>Extra headers to attach (e.g. a tenant or session header issued with a token).
base_url: Option<String>Endpoint override issued with the credential (e.g. a regional proxy). Applied in place of the provider’s configured base URL when set.
Implementations§
Source§impl Credential
impl Credential
pub fn new(secret: impl Into<String>) -> Self
pub fn expires_at(self, unix_ms: u64) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Sourcepub fn is_expired_at(&self, now_ms: u64, skew_ms: u64) -> bool
pub fn is_expired_at(&self, now_ms: u64, skew_ms: u64) -> bool
Whether the credential is expired (or within skew_ms of expiring) at now_ms.
Trait Implementations§
Source§impl Clone for Credential
impl Clone for Credential
Source§impl Debug for Credential
impl Debug for Credential
impl Eq for Credential
Source§impl PartialEq for Credential
impl PartialEq for Credential
impl StructuralPartialEq for Credential
Auto Trait Implementations§
impl Forget for Credential
impl Freeze for Credential
impl Move for Credential
impl RefUnwindSafe for Credential
impl Send for Credential
impl Sync for Credential
impl Unpin for Credential
impl UnsafeUnpin for Credential
impl UnwindSafe for Credential
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.