Skip to main content

PolicySimulationResult

Struct PolicySimulationResult 

Source
pub struct PolicySimulationResult {
    pub action: PolicySimulationResultAction,
    pub evaluated_policies: Vec<EvaluatedPolicy>,
    pub evaluated_unit: Option<EvaluatedUnit>,
    pub matched_rule: Option<MatchedPolicyRule>,
    pub reason: PolicySimulationResultReason,
    pub unmatched_rules: Vec<UnmatchedPolicyRule>,
}
Expand description

The action the real operation would take and why. matchedRule is present exactly when reason is rule_accepted or rule_rejected.

JSON schema
{
 "description": "The action the real operation would take and why. `matchedRule` is present exactly when `reason` is `rule_accepted` or `rule_rejected`.",
 "examples": [
   {
     "action": "reject",
     "evaluatedPolicies": [
       {
         "id": "123e4567-e89b-12d3-a456-426614174000",
         "scope": "project",
         "updatedAt": "2026-09-01T12:00:00Z"
       }
     ],
     "reason": "no_rule_matched",
     "unmatchedRules": [
       {
         "criterion": {
           "ethValue": "1",
           "operator": "<=",
           "type": "ethValue"
         },
         "criterionIndex": 0,
         "observed": {
           "ethValue": "500000000000000000",
           "type": "ethValue"
         },
         "policy": {
           "id": "123e4567-e89b-12d3-a456-426614174000",
           "scope": "project",
           "updatedAt": "2026-09-01T12:00:00Z"
         },
         "ruleIndex": 0
       }
     ]
   }
 ],
 "type": "object",
 "required": [
   "action",
   "evaluatedPolicies",
   "reason",
   "unmatchedRules"
 ],
 "properties": {
   "action": {
     "description": "Whether the real operation would be accepted or rejected.",
     "examples": [
       "reject"
     ],
     "type": "string",
     "enum": [
       "accept",
       "reject"
     ],
     "x-go-type": "string"
   },
   "evaluatedPolicies": {
     "description": "Policies iterated, in order: the project policy, then the account policy. Evaluation stops at the policy containing `matchedRule`. End-user operations consult only the project policy.",
     "type": "array",
     "items": {
       "$ref": "#/components/schemas/EvaluatedPolicy"
     }
   },
   "evaluatedUnit": {
     "$ref": "#/components/schemas/EvaluatedUnit"
   },
   "matchedRule": {
     "$ref": "#/components/schemas/MatchedPolicyRule"
   },
   "reason": {
     "description": "Why the operation got its `action`. Each value implies exactly one `action`.\nWithin a policy, a matching `reject` rule overrides any matching `accept` rule, regardless of rule order.\nWith `accept`: `rule_accepted` means `matchedRule` matched all of its criteria, its action is `accept`, and no `reject` rule in the same policy matched. `no_rule_for_operation` means no rule targeted the operation, so it was accepted by default.\nWith `reject`: `rule_rejected` means `matchedRule` matched all of its criteria and its action is `reject`, so the rejection is caused by the entire rule. `no_rule_matched` means at least one rule targeted the operation but none matched, so it was rejected by default; `unmatchedRules` shows the criterion that disqualified each one.",
     "examples": [
       "no_rule_matched"
     ],
     "type": "string",
     "enum": [
       "rule_accepted",
       "rule_rejected",
       "no_rule_matched",
       "no_rule_for_operation"
     ]
   },
   "unmatchedRules": {
     "description": "Rules targeting the operation that were evaluated and did not match. Within a policy, `reject` rules are evaluated before `accept` rules, and evaluation stops at `matchedRule`. Rules that were not evaluated are omitted. When there is no `matchedRule`, every rule that targeted the operation appears here. Among matching rules with the same action, the first in policy order is `matchedRule`.",
     "type": "array",
     "items": {
       "$ref": "#/components/schemas/UnmatchedPolicyRule"
     }
   }
 }
}

Fields§

§action: PolicySimulationResultAction

Whether the real operation would be accepted or rejected.

§evaluated_policies: Vec<EvaluatedPolicy>

Policies iterated, in order: the project policy, then the account policy. Evaluation stops at the policy containing matchedRule. End-user operations consult only the project policy.

§evaluated_unit: Option<EvaluatedUnit>§matched_rule: Option<MatchedPolicyRule>§reason: PolicySimulationResultReason

Why the operation got its action. Each value implies exactly one action. Within a policy, a matching reject rule overrides any matching accept rule, regardless of rule order. With accept: rule_accepted means matchedRule matched all of its criteria, its action is accept, and no reject rule in the same policy matched. no_rule_for_operation means no rule targeted the operation, so it was accepted by default. With reject: rule_rejected means matchedRule matched all of its criteria and its action is reject, so the rejection is caused by the entire rule. no_rule_matched means at least one rule targeted the operation but none matched, so it was rejected by default; unmatchedRules shows the criterion that disqualified each one.

§unmatched_rules: Vec<UnmatchedPolicyRule>

Rules targeting the operation that were evaluated and did not match. Within a policy, reject rules are evaluated before accept rules, and evaluation stops at matchedRule. Rules that were not evaluated are omitted. When there is no matchedRule, every rule that targeted the operation appears here. Among matching rules with the same action, the first in policy order is matchedRule.

Implementations§

Trait Implementations§

Source§

impl Clone for PolicySimulationResult

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PolicySimulationResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for PolicySimulationResult

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&PolicySimulationResult> for PolicySimulationResult

Source§

fn from(value: &PolicySimulationResult) -> Self

Converts to this type from the input type.
Source§

impl From<PolicySimulationResult> for PolicySimulationResult

Source§

fn from(value: PolicySimulationResult) -> Self

Converts to this type from the input type.
Source§

impl Serialize for PolicySimulationResult

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<PolicySimulationResult> for PolicySimulationResult

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(value: PolicySimulationResult) -> Result<Self, ConversionError>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more