namespace LibNftables; /// /// Represents an apply/validate request source and execution settings. /// public sealed class NftApplyRequest { /// /// Gets or sets ruleset command text source. /// /// Exactly one of or must be provided. public string? RulesetText { get; set; } /// /// Gets or sets ruleset file path source. /// /// Exactly one of or must be provided. public string? RulesetFilePath { get; set; } /// /// Gets or sets a value indicating whether execution should run in dry-run mode. /// public bool DryRun { get; set; } /// /// Gets or sets input parser flags. /// public NftInputFlags InputFlags { get; set; } /// /// Gets or sets output behavior flags. /// public NftOutputFlags OutputFlags { get; set; } /// /// Gets or sets debug flags. /// public NftDebugLevel DebugFlags { get; set; } /// /// Gets or sets optimize flags. /// public NftOptimizeFlags OptimizeFlags { get; set; } /// /// Creates a request from command text. /// /// Ruleset command text. /// Whether the request should run in dry-run mode. /// A configured request instance. public static NftApplyRequest FromText(string rulesetText, bool dryRun = false) => new() { RulesetText = rulesetText, DryRun = dryRun }; /// /// Creates a request from a file path. /// /// Path to file containing ruleset commands. /// Whether the request should run in dry-run mode. /// A configured request instance. public static NftApplyRequest FromFile(string rulesetFilePath, bool dryRun = false) => new() { RulesetFilePath = rulesetFilePath, DryRun = dryRun }; }