From: Aleš Date: Fri, 7 Jan 2022 16:33:08 +0000 (+0100) Subject: docs: datamodel: added some docstring annotations X-Git-Tag: v6.0.0a1~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4c3edd420f0cf840f48d05896eef0ef7881e039;p=thirdparty%2Fknot-resolver.git docs: datamodel: added some docstring annotations - related to #43 --- diff --git a/manager/knot_resolver_manager/datamodel/cache_schema.py b/manager/knot_resolver_manager/datamodel/cache_schema.py index d3447f0b5..61efa39d5 100644 --- a/manager/knot_resolver_manager/datamodel/cache_schema.py +++ b/manager/knot_resolver_manager/datamodel/cache_schema.py @@ -1,17 +1,43 @@ from typing import List, Optional -from knot_resolver_manager.datamodel.types import CheckedPath, SizeUnit, TimeUnit +from knot_resolver_manager.datamodel.types import CheckedPath, DomainName, SizeUnit, TimeUnit from knot_resolver_manager.utils import SchemaNode class PrefillSchema(SchemaNode): - domain: str + """ + Prefill the cache periodically by importing zone data obtained over HTTP. + + --- + origin: Origin for the imported data. Cache prefilling is only supported for the root zone ('.'). + url: URL of the zone file to be imported. + refresh_interval: Time interval between consecutive refreshes of the imported zone data. + ca_file: Path to the file containing a CA certificate bundle that is used to authenticate the HTTPS connection. + """ + + origin: DomainName url: str refresh_interval: TimeUnit = TimeUnit("1d") ca_file: Optional[CheckedPath] = None + def _validate(self) -> None: + if self.origin != ".": + raise ValueError("cache prefilling is not yet supported for non-root zones") + class CacheSchema(SchemaNode): + """ + DNS resolver cache configuration. + + --- + storage: DNS resolver cache storage. + size_max: Maximum size of the cache. + ttl_min: Minimum time-to-live for cache entries. + ttl_max: Maximum time-to-live for cache entries. + ns_timeout: Time interval for which a nameserver address will be ignored after determining that it does not return (useful) answers. + prefill: Prefill the cache periodically by importing zone data obtained over HTTP. + """ + storage: CheckedPath = CheckedPath("/var/cache/knot-resolver") size_max: SizeUnit = SizeUnit("100M") ttl_min: TimeUnit = TimeUnit("5s") diff --git a/manager/knot_resolver_manager/datamodel/config_schema.py b/manager/knot_resolver_manager/datamodel/config_schema.py index bafc07401..23b603272 100644 --- a/manager/knot_resolver_manager/datamodel/config_schema.py +++ b/manager/knot_resolver_manager/datamodel/config_schema.py @@ -60,12 +60,12 @@ class KresConfig(SchemaNode): server: DNS server control and management configuration. options: Fine-tuning global parameters of DNS resolver operation. network: Network connections and protocols. - static-hints: Static hints configuration section. + static_hints: Static hints configuration section. views: List of views and its configuration. policy: List of policy rules and its configuration. rpz: List of Response Policy Zones and its configuration. - stub-zones: List of Stub Zones and its configuration. - forward-zones: List of Forward Zones and its configuration. + stub_zones: List of Stub Zones and its configuration. + forward_zones: List of Forward Zones and its configuration. cache: DNS resolver cache configuration. dnssec: DNSSEC disabling/enabling and configuration. dns64: DNS64 disabling/enabling and configuration. diff --git a/manager/knot_resolver_manager/datamodel/lua_schema.py b/manager/knot_resolver_manager/datamodel/lua_schema.py index e443e70fa..34b671aec 100644 --- a/manager/knot_resolver_manager/datamodel/lua_schema.py +++ b/manager/knot_resolver_manager/datamodel/lua_schema.py @@ -4,6 +4,15 @@ from knot_resolver_manager.utils import SchemaNode class LuaSchema(SchemaNode): + """ + Custom Lua configuration. + + --- + script_only: Ignore all declarative configuration and use only Lua script or file. + script: Custom Lua configuration script. + script_file: Path to custom Lua configuration script file. + """ + script_only: bool = False script: Optional[str] = None script_file: Optional[str] = None diff --git a/manager/knot_resolver_manager/datamodel/server_schema.py b/manager/knot_resolver_manager/datamodel/server_schema.py index 4595404fe..358d9f30f 100644 --- a/manager/knot_resolver_manager/datamodel/server_schema.py +++ b/manager/knot_resolver_manager/datamodel/server_schema.py @@ -65,7 +65,7 @@ class ServerSchema(SchemaNode): groupid: Additional identifier in case more managers are running on single machine. nsid: Name Server Identifier (RFC 5001) which allows DNS clients to request resolver to send back its NSID along with the reply to a DNS request. workers: The number of running 'Knot Resolver daemon' (kresd) workers. Based on number of CPUs if set to 'auto'. - use-cache-gc: Use cache garbage collector (kres-cache-gc) automatically. + use_cache_gc: Use cache garbage collector (kres-cache-gc) automatically. backend: Forces manager to use a specific service manager. Defaults to autodetection. watchdog: Systemd watchdog configuration. Can only be used with 'systemd' backend. rundir: Directory where the manager can create files and which will be manager's cwd diff --git a/manager/knot_resolver_manager/datamodel/view_schema.py b/manager/knot_resolver_manager/datamodel/view_schema.py index 6a655c74e..150fe6ea6 100644 --- a/manager/knot_resolver_manager/datamodel/view_schema.py +++ b/manager/knot_resolver_manager/datamodel/view_schema.py @@ -5,6 +5,15 @@ from knot_resolver_manager.utils import SchemaNode class ViewSchema(SchemaNode): + """ + Configuration parameters that allows you to create personalized policy rules and other. + + --- + subnets: Identifies clients based on subnets. + tsig: Identifies clients based on a TSIG key name. This is only for testing purposes, TSIG signature is not verified! + options: List of flags for clients specified in view. + """ + subnets: Optional[List[IPNetwork]] = None tsig: Optional[List[str]] = None options: Optional[List[FlagsEnum]] = None