namespace LibNftables; /// /// Provides high-level nftables operations backed by libnftables. /// public interface INftablesClient { /// /// Validates a ruleset request using dry-run mode. /// /// The ruleset request to validate. /// A cancellation token. /// /// A validation result. Invalid ruleset syntax or schema errors return = . /// /// Thrown when request input shape is invalid (for example, both text and file source provided). /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. NftValidationResult Validate(NftApplyRequest request, System.Threading.CancellationToken ct = default); /// /// Validates a typed nftables ruleset by rendering it to nft command text in dry-run mode. /// /// The typed ruleset to validate. /// A cancellation token. /// /// A validation result. Invalid nft syntax or schema errors return = . /// /// Thrown when the typed model itself is invalid before native validation begins. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. NftValidationResult ValidateRuleset(NftRuleset ruleset, System.Threading.CancellationToken ct = default); /// /// Asynchronously validates a ruleset request using dry-run mode. /// /// The ruleset request to validate. /// A cancellation token. /// A task that resolves to a validation result. /// Thrown when request input shape is invalid (for example, both text and file source provided). /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. System.Threading.Tasks.Task ValidateAsync(NftApplyRequest request, System.Threading.CancellationToken ct = default); /// /// Asynchronously validates a typed nftables ruleset by rendering it to nft command text in dry-run mode. /// /// The typed ruleset to validate. /// A cancellation token. /// A task that resolves to a validation result. /// Thrown when the typed model itself is invalid before native validation begins. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. System.Threading.Tasks.Task ValidateRulesetAsync(NftRuleset ruleset, System.Threading.CancellationToken ct = default); /// /// Applies a ruleset request. /// /// The ruleset request to apply. /// A cancellation token. /// Thrown when request input shape is invalid or the ruleset cannot be parsed/validated. /// Thrown when insufficient privileges are available for runtime operation. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. /// Thrown for other native execution failures. void Apply(NftApplyRequest request, System.Threading.CancellationToken ct = default); /// /// Applies a typed nftables ruleset by rendering it to nft command text. /// /// The typed ruleset to apply. /// A cancellation token. /// Thrown when the typed model itself is invalid or the rendered ruleset cannot be parsed/validated. /// Thrown when insufficient privileges are available for runtime operation. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. /// Thrown for other native execution failures. void ApplyRuleset(NftRuleset ruleset, System.Threading.CancellationToken ct = default); /// /// Asynchronously applies a ruleset request. /// /// The ruleset request to apply. /// A cancellation token. /// A completed task when apply succeeds. /// Thrown when request input shape is invalid or the ruleset cannot be parsed/validated. /// Thrown when insufficient privileges are available for runtime operation. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. /// Thrown for other native execution failures. System.Threading.Tasks.Task ApplyAsync(NftApplyRequest request, System.Threading.CancellationToken ct = default); /// /// Asynchronously applies a typed nftables ruleset by rendering it to nft command text. /// /// The typed ruleset to apply. /// A cancellation token. /// A completed task when apply succeeds. /// Thrown when the typed model itself is invalid or the rendered ruleset cannot be parsed/validated. /// Thrown when insufficient privileges are available for runtime operation. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. /// Thrown for other native execution failures. System.Threading.Tasks.Task ApplyRulesetAsync(NftRuleset ruleset, System.Threading.CancellationToken ct = default); /// /// Captures the current nftables ruleset from the system. /// /// A cancellation token. /// A snapshot containing the exported ruleset text and capture time. /// Thrown when insufficient privileges are available for runtime operation. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. /// Thrown for other native execution failures. NftSnapshot Snapshot(System.Threading.CancellationToken ct = default); /// /// Asynchronously captures the current nftables ruleset from the system. /// /// A cancellation token. /// A task that resolves to a snapshot. /// Thrown when insufficient privileges are available for runtime operation. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. /// Thrown for other native execution failures. System.Threading.Tasks.Task SnapshotAsync(System.Threading.CancellationToken ct = default); /// /// Restores ruleset state from a previously captured snapshot. /// /// The snapshot to restore. /// A cancellation token. /// Thrown when snapshot content is invalid. /// Thrown when insufficient privileges are available for runtime operation. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. /// Thrown for other native execution failures. void Restore(NftSnapshot snapshot, System.Threading.CancellationToken ct = default); /// /// Asynchronously restores ruleset state from a previously captured snapshot. /// /// The snapshot to restore. /// A cancellation token. /// A completed task when restore succeeds. /// Thrown when snapshot content is invalid. /// Thrown when insufficient privileges are available for runtime operation. /// Thrown when runtime/platform is unsupported. /// Thrown when required native runtime components cannot be loaded. /// Thrown for other native execution failures. System.Threading.Tasks.Task RestoreAsync(NftSnapshot snapshot, System.Threading.CancellationToken ct = default); }