AccessRequest

Struct AccessRequest 

Source
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 request
  • module_name - YANG module being accessed (if applicable)
  • rpc_name - RPC being called (if applicable)
  • operation - Type of operation being performed
  • path - Data path being accessed (if applicable)
  • context - Request context (NETCONF, CLI, WebUI, etc.) - Tail-f extension
  • command - 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 str

Username 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: Operation

Type 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.