Add src files
This commit is contained in:
62
src/LibNftables/NftApplyRequest.cs
Normal file
62
src/LibNftables/NftApplyRequest.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
namespace LibNftables;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an apply/validate request source and execution settings.
|
||||
/// </summary>
|
||||
public sealed class NftApplyRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets ruleset command text source.
|
||||
/// </summary>
|
||||
/// <remarks>Exactly one of <see cref="RulesetText"/> or <see cref="RulesetFilePath"/> must be provided.</remarks>
|
||||
public string? RulesetText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets ruleset file path source.
|
||||
/// </summary>
|
||||
/// <remarks>Exactly one of <see cref="RulesetText"/> or <see cref="RulesetFilePath"/> must be provided.</remarks>
|
||||
public string? RulesetFilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether execution should run in dry-run mode.
|
||||
/// </summary>
|
||||
public bool DryRun { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets input parser flags.
|
||||
/// </summary>
|
||||
public NftInputFlags InputFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets output behavior flags.
|
||||
/// </summary>
|
||||
public NftOutputFlags OutputFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets debug flags.
|
||||
/// </summary>
|
||||
public NftDebugLevel DebugFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets optimize flags.
|
||||
/// </summary>
|
||||
public NftOptimizeFlags OptimizeFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a request from command text.
|
||||
/// </summary>
|
||||
/// <param name="rulesetText">Ruleset command text.</param>
|
||||
/// <param name="dryRun">Whether the request should run in dry-run mode.</param>
|
||||
/// <returns>A configured request instance.</returns>
|
||||
public static NftApplyRequest FromText(string rulesetText, bool dryRun = false)
|
||||
=> new() { RulesetText = rulesetText, DryRun = dryRun };
|
||||
|
||||
/// <summary>
|
||||
/// Creates a request from a file path.
|
||||
/// </summary>
|
||||
/// <param name="rulesetFilePath">Path to file containing ruleset commands.</param>
|
||||
/// <param name="dryRun">Whether the request should run in dry-run mode.</param>
|
||||
/// <returns>A configured request instance.</returns>
|
||||
public static NftApplyRequest FromFile(string rulesetFilePath, bool dryRun = false)
|
||||
=> new() { RulesetFilePath = rulesetFilePath, DryRun = dryRun };
|
||||
}
|
||||
Reference in New Issue
Block a user