From 321e687049f60e0010be30102fb19b910e68e708 Mon Sep 17 00:00:00 2001 From: uccuz Date: Tue, 7 Jun 2022 00:41:15 +0800 Subject: [PATCH] feat: create device model --- compose_viz/models/device.py | 18 ++++++++++++++++++ compose_viz/models/service.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 compose_viz/models/device.py diff --git a/compose_viz/models/device.py b/compose_viz/models/device.py new file mode 100644 index 0000000..e777a3d --- /dev/null +++ b/compose_viz/models/device.py @@ -0,0 +1,18 @@ + +class Device: + def __init__(self, host_path: str, container_path: str, cgroup_permissions: str = None): + self._host_path = host_path + self._container_path = container_path + self._cgroup_permissions = cgroup_permissions + + @property + def host_path(self): + return self._host_path + + @property + def container_path(self): + return self._container_path + + @property + def cgroup_permissions(self): + return self._cgroup_permissions \ No newline at end of file diff --git a/compose_viz/models/service.py b/compose_viz/models/service.py index 4ba1bbe..eed285c 100644 --- a/compose_viz/models/service.py +++ b/compose_viz/models/service.py @@ -19,7 +19,7 @@ class Service: extends: Optional[Extends] = None, cgroup_parent: Optional[str] = None, container_name: Optional[str] = None, - devices: Optional[Device] = None, + devices: Optional[Device] = [], env_file: List[str] = [], expose: List[str] = [], profiles: List[str] = [],