regorus/
policy_info.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#[cfg(feature = "azure_policy")]
5use crate::engine::PolicyParameters;
6use crate::*;
7type String = Rc<str>;
8
9/// Information about a compiled policy, including metadata about modules,
10/// target configuration, and resource types that the policy can evaluate.
11#[derive(serde::Serialize)]
12pub struct PolicyInfo {
13    /// List of module identifiers that were compiled into this policy.
14    /// Each module ID represents a unique policy module that contributes
15    /// rules, functions, or data to the compiled policy.
16    pub module_ids: Vec<String>,
17
18    /// Name of the target configuration used during compilation, if any.
19    /// This indicates which target schema and validation rules were applied.
20    pub target_name: Option<String>,
21
22    /// List of resource types that this policy can evaluate.
23    /// For target-aware policies, this contains the inferred or configured
24    /// resource types. For general policies, this may be empty.
25    pub applicable_resource_types: Vec<String>,
26
27    /// The primary rule or entrypoint that this policy evaluates.
28    /// This is the rule path that will be executed when the policy runs.
29    pub entrypoint_rule: String,
30
31    /// The effect rule name for target-aware policies, if applicable.
32    /// This is the specific effect rule (e.g., "effect", "allow", "deny")
33    /// that determines the policy decision for target evaluation.
34    pub effect_rule: Option<String>,
35
36    /// Parameters that can be configured for this policy.
37    /// Contains parameter names and their expected types or default values.
38    /// Used for parameterized policies that accept configuration at evaluation time.
39    /// Each element represents parameters from a different module.
40    #[cfg(feature = "azure_policy")]
41    pub parameters: Vec<PolicyParameters>,
42}