]> git.llucax.com Git - software/pymin.git/blobdiff - services/vpn/host.py
Add GPL v3 license to the project
[software/pymin.git] / services / vpn / host.py
index d22de661715644a8f4de92cc459a991c1fe84b9b..f7e18320633382ea2a1835f3f695a9bdd6a69517 100644 (file)
@@ -1,21 +1,16 @@
 # vim: set encoding=utf-8 et sw=4 sts=4 :
 
-from pymin.seqtools import Sequence
+from pymin.validation import Item, Field, Any, HostName, \
+                             FullyQualifiedHostName, IPAddress, CIDR
 from pymin.service.util import DictComposedSubHandler
 
 __all__ = ('HostHandler',)
 
 
-class Host(Sequence):
-    def __init__(self, vpn_src, ip, vpn_src_net, key):
-        self.name = vpn_src
-        self.ip = ip
-        self.src_net = vpn_src_net
-        self.pub_key = key
-        self._delete = False
-
-    def as_tuple(self):
-        return(self.name, self.ip, self.src_net, self.pub_key)
+class Host(Item):
+    name = Field(HostName(not_empty=True))
+    address = Field(Any(HostName, FullyQualifiedHostName, IPAddress))
+    subnet = Field(CIDR)
 
 class HostHandler(DictComposedSubHandler):