Class PolicyDecision
Represents the decision of a policy regarding a mutation. Contains approval, denial, modification instructions, and metadata.
Inherited Members
Namespace: ModularityKit.Mutator.Abstractions.Policies
Assembly: ModularityKit.Mutator.dll
Syntax
public sealed class PolicyDecision
Properties
| Edit this page View SourceIsAllowed
Indicates whether the mutation is allowed.
Declaration
public bool IsAllowed { get; init; }
Property Value
| Type | Description |
|---|---|
| bool |
Metadata
Additional metadata for diagnostics or logging.
Declaration
public IReadOnlyDictionary<string, object>? Metadata { get; init; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> |
Modifications
Modifications to apply if the policy alters the mutation.
Declaration
public IReadOnlyDictionary<string, object>? Modifications { get; init; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> |
PolicyName
Name of the policy that made this decision.
Declaration
public string? PolicyName { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
Reason
Reason for the decision (human-readable).
Declaration
public string? Reason { get; init; }
Property Value
| Type | Description |
|---|---|
| string |
Requirements
Requirements that must be fulfilled (e.g., approvals) for the mutation.
Declaration
public IReadOnlyList<PolicyRequirement>? Requirements { get; init; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<PolicyRequirement> |
Severity
Severity of the decision (Info, Warning, Error, Critical).
Declaration
public PolicyDecisionSeverity Severity { get; init; }
Property Value
| Type | Description |
|---|---|
| PolicyDecisionSeverity |
Timestamp
Timestamp when the decision was made.
Declaration
public DateTimeOffset Timestamp { get; init; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset |
Methods
| Edit this page View SourceAllow(string?, string?)
Creates an allow decision.
Declaration
public static PolicyDecision Allow(string? policyName = null, string? reason = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | policyName | Optional policy name. |
| string | reason | Optional human-readable reason. |
Returns
| Type | Description |
|---|---|
| PolicyDecision | A policy decision that allows the mutation. |
Deny(string, string?)
Creates a deny decision with standard error severity.
Declaration
public static PolicyDecision Deny(string reason, string? policyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | reason | Reason for denial. |
| string | policyName | Optional policy name. |
Returns
| Type | Description |
|---|---|
| PolicyDecision | A policy decision that denies the mutation. |
DenyCritical(string, string?)
Creates a deny decision with critical severity.
Declaration
public static PolicyDecision DenyCritical(string reason, string? policyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | reason | Reason for denial. |
| string | policyName | Optional policy name. |
Returns
| Type | Description |
|---|---|
| PolicyDecision | A critical denial policy decision. |
Modify(IReadOnlyDictionary<string, object>, string?)
Creates a modification decision that adjusts mutation values.
Declaration
public static PolicyDecision Modify(IReadOnlyDictionary<string, object> modifications, string? policyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyDictionary<string, object> | modifications | Dictionary of modifications to apply. |
| string | policyName | Optional policy name. |
Returns
| Type | Description |
|---|---|
| PolicyDecision | A policy decision that modifies the mutation. |
RequireApproval(PolicyRequirement, string?)
Creates a decision that requires additional approval before proceeding.
Declaration
public static PolicyDecision RequireApproval(PolicyRequirement requirement, string? policyName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| PolicyRequirement | requirement | The requirement that must be fulfilled. |
| string | policyName | Optional policy name. |
Returns
| Type | Description |
|---|---|
| PolicyDecision | A policy decision requiring approval. |