pub enum RouteAction {
Proxy {
rewrite: Option<PathRewrite>,
},
Redirect {
scheme: Option<String>,
host: Option<String>,
path: Option<String>,
status: u16,
},
Respond {
status: u16,
body: Option<String>,
headers: BTreeMap<String, String>,
},
Mock {
mock: MockAction,
},
Ai {
endpoint: AiEndpoint,
dialect: AiIngressDialect,
},
NanoService {
nano: NanoServiceAction,
},
}Expand description
What the gateway does when a route matches.
Variants§
Proxy
Forward to the route’s service (its upstream).
rewrite (at most ONE per action in v1) is applied to the inbound
path before the request is sent upstream; the query string is always
preserved verbatim.
Fields
rewrite: Option<PathRewrite>Redirect
Respond
Fields
Mock
Serve a canned response without contacting any upstream (DW-047
mock mode). The route’s service is still required by the
schema (the frozen vocabulary), but a mock route never dials
it — the whole point is serving without a backend. Pair with
request_validation to mock a write endpoint that still
rejects malformed bodies. See MockAction.
Fields
mock: MockActionAi
AI provider translation (DW-075): the request body is parsed as
an OpenAI chat-completions request, its model resolved through
the gateway’s ai: block to a provider, translated to that
provider’s wire format (OpenAI/Anthropic/Gemini), sent through
the provider’s upstream, and the response translated back to the
OpenAI shape. The route’s service is still required by the
schema but never dialed. Requires an ai: block (validation
rejects the pairing otherwise). stream: true requests are
served via zero-buffer SSE pass-through (DW-077).
AI-02: the endpoint field selects which AI endpoint the route
serves. The default is chat (the existing behavior). Other
endpoints (embeddings, images, audio, moderation) are
proxied as a passthrough: the request body is forwarded to the
provider’s upstream as-is (no adapter translation), and the
response is returned as-is. Model governance (allowlist check)
still applies using the model field from the request body.
Fields
endpoint: AiEndpointdialect: AiIngressDialectAI-05 (#195): The client-facing request dialect. Defaults
to openai (the historical behavior). When set to
anthropic or gemini, the gateway parses the incoming
request using that dialect’s native format and translates
to the canonical ChatRequest. When set to passthrough,
the request body is forwarded to the provider as-is (no
translation, still metered/governed).
NanoService
WASM route handler (nano-service, DW-106): instead of proxying
to an upstream, the route action runs a WASM module that
generates the response directly. The module implements a simple
request->response handler ABI over the existing wasmtime runtime
(compiled into every build; no cargo feature). The route’s
service is still
required by the schema (the frozen vocabulary) but never dialed
– the whole point is serving without a backend. See
NanoServiceAction.
Fields
nano: NanoServiceActionTrait Implementations§
Source§impl Clone for RouteAction
impl Clone for RouteAction
Source§fn clone(&self) -> RouteAction
fn clone(&self) -> RouteAction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouteAction
impl Debug for RouteAction
Source§impl<'de> Deserialize<'de> for RouteAction
impl<'de> Deserialize<'de> for RouteAction
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>,
Source§impl JsonSchema for RouteAction
impl JsonSchema for RouteAction
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for RouteAction
impl PartialEq for RouteAction
Source§impl Serialize for RouteAction
impl Serialize for RouteAction
impl StructuralPartialEq for RouteAction
Auto Trait Implementations§
impl Freeze for RouteAction
impl RefUnwindSafe for RouteAction
impl Send for RouteAction
impl Sync for RouteAction
impl Unpin for RouteAction
impl UnwindSafe for RouteAction
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more