use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct SecretLease {
pub lease_id: String,
pub secret_ref: String,
pub bound_session_id: String,
pub bound_server_id: String,
pub bound_tool_name: String,
pub approval_id: Option<String>,
pub injection_method: InjectionMethod,
pub expires_at: i64,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[serde(rename_all = "PascalCase")]
pub enum InjectionMethod {
HttpHeader,
ChildEnv,
Pipe,
TempFile,
}
impl std::fmt::Debug for SecretLease {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("SecretLease")
.field("lease_id", &self.lease_id)
.field("secret_ref", &self.secret_ref)
.field("injection_method", &self.injection_method)
.field("expires_at", &self.expires_at)
.finish_non_exhaustive()
}
}
impl std::fmt::Display for SecretLease {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "SecretLease({})", self.secret_ref)
}
}