pub struct AuditNote(/* private fields */);Expand description
Handler-side handle on the current request’s audit event.
Extract it next to RequestCtx and describe the operation before
the first fallible call, so the description is kept on the error
path too:
ⓘ
note.action("group.delete").target("group", &label).detail("force", q.force);Outside an audited request (GET routes, unit tests) the handle is inert and every call is a no-op. Never put a credential in it.
Implementations§
Source§impl AuditNote
impl AuditNote
Sourcepub fn action(&self, action: &'static str) -> &Self
pub fn action(&self, action: &'static str) -> &Self
Stable operation name, <resource>.<verb> (e.g. group.delete).
Sourcepub fn target(&self, kind: &str, value: impl Into<String>) -> &Self
pub fn target(&self, kind: &str, value: impl Into<String>) -> &Self
Add one object of kind (group, node, hosts, …) that the
operation acts on.
Sourcepub fn targets<I, S>(&self, kind: &str, values: I) -> &Self
pub fn targets<I, S>(&self, kind: &str, values: I) -> &Self
Add several objects of kind. No values, no entry.
Sourcepub fn nodes<I, S>(&self, values: I) -> &Self
pub fn nodes<I, S>(&self, values: I) -> &Self
Record the node xnames the server resolved the targets to.
Trait Implementations§
Source§impl<S: Send + Sync> FromRequestParts<S> for AuditNote
impl<S: Send + Sync> FromRequestParts<S> for AuditNote
Source§type Rejection = Infallible
type Rejection = Infallible
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
Source§async fn from_request_parts(
parts: &mut Parts,
_state: &S,
) -> Result<Self, Self::Rejection>
async fn from_request_parts( parts: &mut Parts, _state: &S, ) -> Result<Self, Self::Rejection>
Perform the extraction.
Auto Trait Implementations§
impl Freeze for AuditNote
impl RefUnwindSafe for AuditNote
impl Send for AuditNote
impl Sync for AuditNote
impl Unpin for AuditNote
impl UnsafeUnpin for AuditNote
impl UnwindSafe for AuditNote
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S, T> FromRequest<S, ViaParts> for T
impl<S, T> FromRequest<S, ViaParts> for T
§type Rejection = <T as FromRequestParts<S>>::Rejection
type Rejection = <T as FromRequestParts<S>>::Rejection
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
§fn from_request(
req: Request<Body>,
state: &S,
) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>
Perform the extraction.
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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.