]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: datamodel: view_schema update
authorAleš Mrázek <ales.mrazek@nic.cz>
Thu, 30 Mar 2023 21:16:09 +0000 (23:16 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 9 Jun 2023 11:54:07 +0000 (11:54 +0000)
manager/knot_resolver_manager/datamodel/view_schema.py

index 1af397785811f4f47de792b213162c31b04132b1..210336602b1beace6a4767a72ad5ee000203c4d2 100644 (file)
@@ -1,7 +1,20 @@
-from typing import List, Optional
-
-from knot_resolver_manager.datamodel.types import IDPattern, IPNetwork, PolicyFlagEnum
+from typing import List, Optional, Union
+from typing_extensions import Literal
 from knot_resolver_manager.utils.modeling import ConfigSchema
+from knot_resolver_manager.datamodel.types import IDPattern, IPNetwork
+
+
+class ViewOptionsSchema(ConfigSchema):
+    """
+    Configuration options for clients identified by the view.
+
+    ---
+    minimize: Send minimum amount of information in recursive queries to enhance privacy.
+    dns64: Enable/disable DNS64.
+    """
+
+    minimize: bool = True
+    dns64: bool = True
 
 
 class ViewSchema(ConfigSchema):
@@ -11,14 +24,16 @@ class ViewSchema(ConfigSchema):
     ---
     subnets: Identifies the client based on his subnet.
     tsig: Identifies the client based on a TSIG key name (for testing purposes, TSIG signature is not verified!).
-    options: Configuration flags for clients identified by the view.
+    options: Configuration options for clients identified by the view.
+    answer: Direct approach how to handle request from clients identified by the view.
     tags: Tags to link with other policy rules.
     """
 
-    subnets: Optional[List[IPNetwork]] = None
+    subnets: Optional[Union[List[IPNetwork], IPNetwork]] = None
     tsig: Optional[List[str]] = None
-    options: Optional[List[PolicyFlagEnum]] = None
     tags: Optional[List[IDPattern]] = None
+    answer: Optional[Literal["allow", "refused"]] = None
+    options: ViewOptionsSchema = ViewOptionsSchema()
 
     def _validate(self) -> None:
         if self.tsig is None and self.subnets is None: