// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.Generic; using System.Text.Json.Serialization; #nullable enable namespace Regorus { /// /// Information about a compiled policy, including metadata about modules, /// target configuration, and resource types that the policy can evaluate. /// public class PolicyInfo { /// /// List of module identifiers that were compiled into this policy. /// Each module ID represents a unique policy module that contributes /// rules, functions, or data to the compiled policy. /// [JsonPropertyName("module_ids")] public List ModuleIds { get; set; } = new List(); /// /// Name of the target configuration used during compilation, if any. /// This indicates which target schema and validation rules were applied. /// [JsonPropertyName("target_name")] public string? TargetName { get; set; } /// /// List of resource types that this policy can evaluate. /// For target-aware policies, this contains the inferred or configured /// resource types. For general policies, this may be empty. /// [JsonPropertyName("applicable_resource_types")] public List ApplicableResourceTypes { get; set; } = new List(); /// /// The primary rule or entrypoint that this policy evaluates. /// This is the rule path that will be executed when the policy runs. /// [JsonPropertyName("entrypoint_rule")] public string EntrypointRule { get; set; } = string.Empty; /// /// The effect rule name for target-aware policies, if applicable. /// This is the specific effect rule (e.g., "effect", "allow", "deny") /// that determines the policy decision for target evaluation. /// [JsonPropertyName("effect_rule")] public string? EffectRule { get; set; } /// /// Parameters that can be configured for this policy. /// Contains parameter names and their expected types or default values. /// Used for parameterized policies that accept configuration at evaluation time. /// Each element represents parameters from a different module. /// [JsonPropertyName("parameters")] public List Parameters { get; set; } = new List(); } /// /// Parameters that can be configured for a policy. /// public class PolicyParameters { /// /// Source file where the parameters are defined. /// [JsonPropertyName("source_file")] public string SourceFile { get; set; } = string.Empty; /// /// List of parameter definitions. /// [JsonPropertyName("parameters")] public List Parameters { get; set; } = new List(); /// /// List of parameter modifiers. /// [JsonPropertyName("modifiers")] public List Modifiers { get; set; } = new List(); } /// /// A single parameter definition. /// public class PolicyParameter { /// /// Name of the parameter. /// [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// /// Type of the parameter. /// [JsonPropertyName("type")] public string Type { get; set; } = string.Empty; /// /// Default value of the parameter, if any. /// [JsonPropertyName("default")] public object? Default { get; set; } /// /// Description of the parameter. /// [JsonPropertyName("description")] public string? Description { get; set; } /// /// Allowed values for the parameter, if constrained. /// [JsonPropertyName("allowed_values")] public List? AllowedValues { get; set; } } /// /// A parameter modifier that affects parameter behavior. /// public class PolicyParameterModifier { /// /// Name of the modifier. /// [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// /// Value of the modifier. /// [JsonPropertyName("value")] public object? Value { get; set; } } }