pub struct Principal {
pub id: String,
pub role: Role,
pub grants: Vec<String>,
pub rate: Option<String>,
pub budget: Option<Budget>,
pub labels: BTreeMap<String, String>,
}Expand description
A resolved caller.
Fields§
§id: StringA stable id for logs/audit/context (operator, user:<sub>, agent:<id>).
role: Role§grants: Vec<String>Explicit tool-name grants (patterns) beyond the role defaults.
rate: Option<String>The rate quota ("<burst>/<per>s") and budget scope key, if any.
budget: Option<Budget>§labels: BTreeMap<String, String>Operator-declared attributes that travel with everything this
principal causes (the run, the MCP _meta, the audit line).
Implementations§
Source§impl Principal
impl Principal
pub fn anonymous() -> Principal
pub fn is_operator(&self) -> bool
pub fn is_anonymous(&self) -> bool
Sourcepub fn may(&self, method: &str, op: Option<&str>) -> bool
pub fn may(&self, method: &str, op: Option<&str>) -> bool
May this principal invoke A2A method method?
op is the command tool name for a command DataPart (else None).
The matrix is deny-by-default: anonymous callers get nothing, operators
get everything, and every other role is limited to the named read/task
methods below — an unrecognised method falls through to false.
Sourcepub fn may_command(&self, tool: &str) -> bool
pub fn may_command(&self, tool: &str) -> bool
May this principal run command tool tool?
Trait Implementations§
impl StructuralPartialEq for Principal
Auto Trait Implementations§
impl Freeze for Principal
impl RefUnwindSafe for Principal
impl Send for Principal
impl Sync for Principal
impl Unpin for Principal
impl UnsafeUnpin for Principal
impl UnwindSafe for Principal
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