pub struct TokenLeaseContext {
pub family: TokenFamily,
pub scope: ScopeSet,
pub requested_at: OffsetDateTime,
pub minimum_ttl: Duration,
pub reason: Option<String>,
}Expand description
Metadata describing what kind of lease the caller is requesting.
Fields§
§family: TokenFamilyToken family tied to the lease.
scope: ScopeSetScope set tied to the lease.
requested_at: OffsetDateTimeInstant that should be treated as “now” for freshness checks.
minimum_ttl: DurationMinimum TTL the caller wants to guarantee.
reason: Option<String>Optional annotation that can flow into logs/metrics.
Implementations§
Source§impl TokenLeaseContext
impl TokenLeaseContext
Sourcepub fn new(family: TokenFamily, scope: ScopeSet) -> Self
pub fn new(family: TokenFamily, scope: ScopeSet) -> Self
Creates a new context for the provided token family + scope set.
Sourcepub fn with_requested_at(self, instant: OffsetDateTime) -> Self
pub fn with_requested_at(self, instant: OffsetDateTime) -> Self
Overrides the instant used for freshness calculations.
Sourcepub fn with_minimum_ttl(self, ttl: Duration) -> Self
pub fn with_minimum_ttl(self, ttl: Duration) -> Self
Ensures the lease is only granted if the token will remain valid for at least the provided TTL.
Sourcepub fn with_reason(self, reason: impl Into<String>) -> Self
pub fn with_reason(self, reason: impl Into<String>) -> Self
Adds an optional human-readable reason for observability.
Trait Implementations§
Source§impl Clone for TokenLeaseContext
impl Clone for TokenLeaseContext
Source§fn clone(&self) -> TokenLeaseContext
fn clone(&self) -> TokenLeaseContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for TokenLeaseContext
impl RefUnwindSafe for TokenLeaseContext
impl Send for TokenLeaseContext
impl Sync for TokenLeaseContext
impl Unpin for TokenLeaseContext
impl UnwindSafe for TokenLeaseContext
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