pub struct ProxyRule {
pub path_pattern: String,
pub target_url: String,
pub enabled: bool,
pub pattern: String,
pub upstream_url: String,
pub migration_mode: MigrationMode,
pub migration_group: Option<String>,
pub condition: Option<String>,
}Use mockforge_proxy crate directly
Expand description
Proxy routing rule
Fieldsยง
ยงpath_pattern: StringUse mockforge_proxy crate directly
Path pattern to match
target_url: StringUse mockforge_proxy crate directly
Target URL for this rule
enabled: boolUse mockforge_proxy crate directly
Whether this rule is enabled
pattern: StringUse mockforge_proxy crate directly
Pattern for matching (alias for path_pattern)
upstream_url: StringUse mockforge_proxy crate directly
Upstream URL (alias for target_url)
migration_mode: MigrationModeUse mockforge_proxy crate directly
Migration mode for this route (mock, shadow, real, auto)
migration_group: Option<String>Use mockforge_proxy crate directly
Migration group this route belongs to (optional)
condition: Option<String>Use mockforge_proxy crate directly
Conditional expression for proxying (JSONPath, JavaScript-like, or Rhai script) If provided, the request will only be proxied if the condition evaluates to true Examples:
- JSONPath: โ$.user.role == โadminโโ
- Header check: โheader[authorization] != โโโ
- Query param: โqueryenv == โproductionโโ
- Complex: โAND($.user.role == โadminโ, header[x-forwarded-for] != โโ)โ
Trait Implementationsยง
Sourceยงimpl<'de> Deserialize<'de> for ProxyRule
impl<'de> Deserialize<'de> for ProxyRule
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 ProxyRule
impl JsonSchema for ProxyRule
Sourceยงfn schema_name() -> String
fn schema_name() -> String
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 is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreAuto Trait Implementationsยง
impl Freeze for ProxyRule
impl RefUnwindSafe for ProxyRule
impl Send for ProxyRule
impl Sync for ProxyRule
impl Unpin for ProxyRule
impl UnsafeUnpin for ProxyRule
impl UnwindSafe for ProxyRule
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> 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