feat: add service property

This commit is contained in:
uccuz 2022-06-07 00:34:18 +08:00
parent 382487eca0
commit edf56997bf

View file

@ -1,5 +1,6 @@
from typing import List, Optional from typing import List, Optional
from compose_viz.models.device import Device
from compose_viz.models.extends import Extends from compose_viz.models.extends import Extends
from compose_viz.models.port import Port from compose_viz.models.port import Port
from compose_viz.models.volume import Volume from compose_viz.models.volume import Volume
@ -18,7 +19,7 @@ class Service:
extends: Optional[Extends] = None, extends: Optional[Extends] = None,
cgroup_parent: Optional[str] = None, cgroup_parent: Optional[str] = None,
container_name: Optional[str] = None, container_name: Optional[str] = None,
devices: List[str] = [], devices: Optional[Device] = None,
env_file: List[str] = [], env_file: List[str] = [],
expose: List[str] = [], expose: List[str] = [],
profiles: List[str] = [], profiles: List[str] = [],
@ -31,12 +32,12 @@ class Service:
self._depends_on = depends_on self._depends_on = depends_on
self._links = links self._links = links
self._extends = extends self._extends = extends
self.cgroup_parent = cgroup_parent self._cgroup_parent = cgroup_parent
self.container_name = container_name self._container_name = container_name
self.devices = devices self._devices = devices
self.env_file = env_file self._env_file = env_file
self.expose = expose self._expose = expose
self.profiles = profiles self._profiles = profiles
@property @property
def name(self): def name(self):
@ -69,3 +70,27 @@ class Service:
@property @property
def extends(self): def extends(self):
return self._extends 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