From edf56997bfd06d5a8b79659a9e6ecb109cee91c1 Mon Sep 17 00:00:00 2001 From: uccuz Date: Tue, 7 Jun 2022 00:34:18 +0800 Subject: [PATCH] feat: add service property --- compose_viz/models/service.py | 39 ++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/compose_viz/models/service.py b/compose_viz/models/service.py index abd94f6..4ba1bbe 100644 --- a/compose_viz/models/service.py +++ b/compose_viz/models/service.py @@ -1,5 +1,6 @@ from typing import List, Optional +from compose_viz.models.device import Device from compose_viz.models.extends import Extends from compose_viz.models.port import Port from compose_viz.models.volume import Volume @@ -18,7 +19,7 @@ class Service: extends: Optional[Extends] = None, cgroup_parent: Optional[str] = None, container_name: Optional[str] = None, - devices: List[str] = [], + devices: Optional[Device] = None, env_file: List[str] = [], expose: List[str] = [], profiles: List[str] = [], @@ -31,12 +32,12 @@ class Service: self._depends_on = depends_on self._links = links self._extends = extends - self.cgroup_parent = cgroup_parent - self.container_name = container_name - self.devices = devices - self.env_file = env_file - self.expose = expose - self.profiles = profiles + self._cgroup_parent = cgroup_parent + self._container_name = container_name + self._devices = devices + self._env_file = env_file + self._expose = expose + self._profiles = profiles @property def name(self): @@ -69,3 +70,27 @@ class Service: @property def extends(self): return self._extends + + @property + def cgroup_parent(self): + return self._cgroup_parent + + @property + def container_name(self): + return self._container_name + + @property + def devices(self): + return self._devices + + @property + def env_file(self): + return self._env_file + + @property + def expose(self): + return self._expose + + @property + def profiles(self): + return self._profiles