pub struct SecretRequest {
pub name: String,
pub tool_name: Option<String>,
pub app_name: Option<String>,
pub user_id: Option<String>,
pub session_id: Option<String>,
pub invocation_id: Option<String>,
pub purpose: Option<String>,
}Expand description
A described secret access.
Carries the requested name plus the identity the framework observed at the call
site, so a SecretService can authorize and audit rather than being handed a
bare name with no context.
§Example
use adk_core::SecretRequest;
let request = SecretRequest::new("payments-api-key")
.with_tool_name("charge_card")
.with_purpose("authorize a customer payment");
assert_eq!(request.tool_name.as_deref(), Some("charge_card"));Fields§
§name: StringName of the requested secret.
tool_name: Option<String>The tool making the request, when the access came from a tool.
Set by the framework from the tool it dispatched, never from a value the tool provided.
app_name: Option<String>Application the run belongs to.
user_id: Option<String>Authenticated user the run belongs to.
session_id: Option<String>Session the run belongs to.
invocation_id: Option<String>Invocation the access happened in, for correlating audit records.
purpose: Option<String>Why the secret is needed, when the caller states it.
Implementations§
Source§impl SecretRequest
impl SecretRequest
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates a request for name with no identity attached.
Sourcepub fn with_tool_name(self, tool_name: impl Into<String>) -> Self
pub fn with_tool_name(self, tool_name: impl Into<String>) -> Self
Attaches the requesting tool’s name.
Sourcepub fn with_identity(
self,
app_name: impl Into<String>,
user_id: impl Into<String>,
session_id: impl Into<String>,
) -> Self
pub fn with_identity( self, app_name: impl Into<String>, user_id: impl Into<String>, session_id: impl Into<String>, ) -> Self
Attaches the run’s identity.
Sourcepub fn with_invocation_id(self, invocation_id: impl Into<String>) -> Self
pub fn with_invocation_id(self, invocation_id: impl Into<String>) -> Self
Attaches the invocation the access happened in.
Sourcepub fn with_purpose(self, purpose: impl Into<String>) -> Self
pub fn with_purpose(self, purpose: impl Into<String>) -> Self
Attaches a stated purpose.
Trait Implementations§
Source§impl Clone for SecretRequest
impl Clone for SecretRequest
Source§fn clone(&self) -> SecretRequest
fn clone(&self) -> SecretRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more