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