pub struct AccessRequest<'a> {
pub user: &'a str,
pub module_name: Option<&'a str>,
pub rpc_name: Option<&'a str>,
pub operation: Operation,
pub path: Option<&'a str>,
pub context: Option<&'a RequestContext>,
pub command: Option<&'a str>,
}Expand description
Represents an access request for validation
This structure contains all the information needed to validate an access request against NACM rules. Uses borrowed string slices for efficiency (avoids copying strings).
§Lifetimes
The 'a lifetime parameter ensures that this struct doesn’t outlive
the data it references. This is Rust’s way of preventing dangling pointers.
§Fields
user- Username making the requestmodule_name- YANG module being accessed (if applicable)rpc_name- RPC being called (if applicable)operation- Type of operation being performedpath- Data path being accessed (if applicable)context- Request context (NETCONF, CLI, WebUI, etc.) - Tail-f extensioncommand- Command being executed (for command rules) - Tail-f extension
§Examples
use nacm_validator::{AccessRequest, Operation, RequestContext};
let request = AccessRequest {
user: "alice",
module_name: Some("ietf-interfaces"),
rpc_name: None,
operation: Operation::Read,
path: Some("/interfaces/interface[name='eth0']"),
context: Some(&RequestContext::NETCONF),
command: None,
};Fields§
§user: &'a strUsername making the access request
module_name: Option<&'a str>YANG module name being accessed (None if not module-specific)
rpc_name: Option<&'a str>RPC name being called (None if not an RPC call)
operation: OperationType of operation being performed
path: Option<&'a str>XPath or data path being accessed (None if not path-specific)
context: Option<&'a RequestContext>Request context (NETCONF, CLI, WebUI, etc.) - Tail-f extension
command: Option<&'a str>Command being executed (for command rules) - Tail-f extension
Auto Trait Implementations§
impl<'a> Freeze for AccessRequest<'a>
impl<'a> RefUnwindSafe for AccessRequest<'a>
impl<'a> Send for AccessRequest<'a>
impl<'a> Sync for AccessRequest<'a>
impl<'a> Unpin for AccessRequest<'a>
impl<'a> UnwindSafe for AccessRequest<'a>
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