pub struct DelegationRequest { /* private fields */ }Expand description
Request type for AdminOperations::delegate.
Bundles the four required delegation fields and the optional duration into a single self-documenting value.
§Example
ⓘ
let req = DelegationRequest::new("admin_1", "user_2", "write", "reports")
.duration(Duration::from_secs(3600));Implementations§
Source§impl DelegationRequest
impl DelegationRequest
Sourcepub fn new(
delegator_id: impl Into<String>,
delegatee_id: impl Into<String>,
action: impl Into<String>,
resource: impl Into<String>,
) -> Self
pub fn new( delegator_id: impl Into<String>, delegatee_id: impl Into<String>, action: impl Into<String>, resource: impl Into<String>, ) -> Self
Create a delegation request with required parameters.
The default duration is 1 hour. Override with duration.
Sourcepub fn duration(self, duration: Duration) -> Self
pub fn duration(self, duration: Duration) -> Self
Set the delegation duration (replaces the default of 1 hour).
Sourcepub fn delegator_id(&self) -> &str
pub fn delegator_id(&self) -> &str
Returns the ID of the user granting permissions.
Sourcepub fn delegatee_id(&self) -> &str
pub fn delegatee_id(&self) -> &str
Returns the ID of the user receiving permissions.
Sourcepub fn get_duration(&self) -> Duration
pub fn get_duration(&self) -> Duration
Returns how long the delegation is valid.
Trait Implementations§
Source§impl Clone for DelegationRequest
impl Clone for DelegationRequest
Source§fn clone(&self) -> DelegationRequest
fn clone(&self) -> DelegationRequest
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 DelegationRequest
impl RefUnwindSafe for DelegationRequest
impl Send for DelegationRequest
impl Sync for DelegationRequest
impl Unpin for DelegationRequest
impl UnsafeUnpin for DelegationRequest
impl UnwindSafe for DelegationRequest
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
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<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 more