pub struct AgentProfile {
pub agent_id: String,
pub name: String,
pub version: String,
pub capabilities: Vec<String>,
pub auth_token: Option<String>,
pub token_expires_at: Option<DateTime<Utc>>,
pub metadata: HashMap<String, Value>,
}Expand description
Agent profile for authentication and identity propagation.
Fields§
§agent_id: StringUnique agent identifier.
name: StringHuman-readable agent name.
version: StringAgent version.
capabilities: Vec<String>Capabilities this agent advertises.
auth_token: Option<String>Authentication token for this agent.
token_expires_at: Option<DateTime<Utc>>Token expiration time.
metadata: HashMap<String, Value>Metadata for custom properties.
Implementations§
Source§impl AgentProfile
impl AgentProfile
Sourcepub fn new(agent_id: impl Into<String>, name: impl Into<String>) -> Self
pub fn new(agent_id: impl Into<String>, name: impl Into<String>) -> Self
Create a new agent profile.
Sourcepub fn with_capability(self, capability: impl Into<String>) -> Self
pub fn with_capability(self, capability: impl Into<String>) -> Self
Add a capability string.
Sourcepub fn with_auth_token(
self,
token: impl Into<String>,
expires_at: Option<DateTime<Utc>>,
) -> Self
pub fn with_auth_token( self, token: impl Into<String>, expires_at: Option<DateTime<Utc>>, ) -> Self
Set the authentication token (and optional expiry) for this profile.
Sourcepub fn is_token_valid(&self) -> bool
pub fn is_token_valid(&self) -> bool
Return whether the currently attached token exists and is not expired.
Sourcepub fn generate_token(&mut self, validity_hours: i64)
pub fn generate_token(&mut self, validity_hours: i64)
Generate a new bearer token for this agent and set token_expires_at.
The generated token is URL-safe alphanumeric and intended for use as a
Authorization: Bearer <token> credential.
Trait Implementations§
Source§impl Clone for AgentProfile
impl Clone for AgentProfile
Source§fn clone(&self) -> AgentProfile
fn clone(&self) -> AgentProfile
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 moreSource§impl Debug for AgentProfile
impl Debug for AgentProfile
Source§impl<'de> Deserialize<'de> for AgentProfile
impl<'de> Deserialize<'de> for AgentProfile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AgentProfile
impl RefUnwindSafe for AgentProfile
impl Send for AgentProfile
impl Sync for AgentProfile
impl Unpin for AgentProfile
impl UnwindSafe for AgentProfile
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].