pub struct AgentResponse {
pub version: u32,
pub decision: Decision,
pub request_headers: Vec<HeaderOp>,
pub response_headers: Vec<HeaderOp>,
pub routing_metadata: HashMap<String, String>,
pub audit: AuditMetadata,
pub needs_more: bool,
pub request_body_mutation: Option<BodyMutation>,
pub response_body_mutation: Option<BodyMutation>,
pub websocket_decision: Option<WebSocketDecision>,
}Expand description
Agent response message
Fields§
§version: u32Protocol version
decision: DecisionDecision
request_headers: Vec<HeaderOp>Header modifications for request
response_headers: Vec<HeaderOp>Header modifications for response
routing_metadata: HashMap<String, String>Routing metadata modifications
audit: AuditMetadataAudit metadata
needs_more: boolAgent needs more data to make a final decision
When true, the current decision is provisional and may change
after processing more body chunks. The proxy should continue
streaming body data to this agent.
When false (default), the decision is final.
request_body_mutation: Option<BodyMutation>Request body mutation (for streaming mode)
If present, applies the mutation to the current request body chunk.
Only valid for RequestBodyChunk events.
response_body_mutation: Option<BodyMutation>Response body mutation (for streaming mode)
If present, applies the mutation to the current response body chunk.
Only valid for ResponseBodyChunk events.
websocket_decision: Option<WebSocketDecision>WebSocket frame decision
Only valid for WebSocketFrame events. If not set, defaults to Allow.
Implementations§
Source§impl AgentResponse
impl AgentResponse
Sourcepub fn default_allow() -> Self
pub fn default_allow() -> Self
Create a default allow response
Sourcepub fn needs_more_data() -> Self
pub fn needs_more_data() -> Self
Create a streaming response indicating more data is needed
Sourcepub fn websocket_allow() -> Self
pub fn websocket_allow() -> Self
Create a WebSocket allow response
Sourcepub fn websocket_drop() -> Self
pub fn websocket_drop() -> Self
Create a WebSocket drop response (drop the frame, don’t forward)
Sourcepub fn websocket_close(code: u16, reason: String) -> Self
pub fn websocket_close(code: u16, reason: String) -> Self
Create a WebSocket close response (close the connection)
Sourcepub fn with_websocket_decision(self, decision: WebSocketDecision) -> Self
pub fn with_websocket_decision(self, decision: WebSocketDecision) -> Self
Set WebSocket decision
Sourcepub fn with_request_body_mutation(self, mutation: BodyMutation) -> Self
pub fn with_request_body_mutation(self, mutation: BodyMutation) -> Self
Create a streaming response with body mutation
Sourcepub fn with_response_body_mutation(self, mutation: BodyMutation) -> Self
pub fn with_response_body_mutation(self, mutation: BodyMutation) -> Self
Create a streaming response with response body mutation
Sourcepub fn set_needs_more(self, needs_more: bool) -> Self
pub fn set_needs_more(self, needs_more: bool) -> Self
Set needs_more flag
Sourcepub fn add_request_header(self, op: HeaderOp) -> Self
pub fn add_request_header(self, op: HeaderOp) -> Self
Add a request header modification
Sourcepub fn add_response_header(self, op: HeaderOp) -> Self
pub fn add_response_header(self, op: HeaderOp) -> Self
Add a response header modification
Sourcepub fn with_audit(self, audit: AuditMetadata) -> Self
pub fn with_audit(self, audit: AuditMetadata) -> Self
Add audit metadata
Trait Implementations§
Source§impl Clone for AgentResponse
impl Clone for AgentResponse
Source§fn clone(&self) -> AgentResponse
fn clone(&self) -> AgentResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentResponse
impl Debug for AgentResponse
Source§impl<'de> Deserialize<'de> for AgentResponse
impl<'de> Deserialize<'de> for AgentResponse
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>,
Auto Trait Implementations§
impl Freeze for AgentResponse
impl RefUnwindSafe for AgentResponse
impl Send for AgentResponse
impl Sync for AgentResponse
impl Unpin for AgentResponse
impl UnwindSafe for AgentResponse
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request