compose-viz/compose_viz/models/service.py

97 lines
2.1 KiB
Python
Raw Normal View History

2022-05-18 17:28:18 +02:00
from typing import List, Optional
2022-05-07 18:42:14 +02:00
2022-06-06 18:34:18 +02:00
from compose_viz.models.device import Device
2022-05-27 08:17:04 +02:00
from compose_viz.models.extends import Extends
from compose_viz.models.port import Port
from compose_viz.models.volume import Volume
2022-05-18 09:12:24 +02:00
2022-05-07 18:42:14 +02:00
class Service:
2022-05-18 17:28:18 +02:00
def __init__(
self,
name: str,
image: Optional[str] = None,
2022-05-21 17:19:01 +02:00
ports: List[Port] = [],
2022-05-18 17:28:18 +02:00
networks: List[str] = [],
2022-05-21 11:41:26 +02:00
volumes: List[Volume] = [],
2022-05-18 17:28:18 +02:00
depends_on: List[str] = [],
links: List[str] = [],
extends: Optional[Extends] = None,
2022-06-03 11:19:43 +02:00
cgroup_parent: Optional[str] = None,
container_name: Optional[str] = None,
2022-06-06 18:34:18 +02:00
devices: Optional[Device] = None,
2022-06-03 10:57:06 +02:00
env_file: List[str] = [],
expose: List[str] = [],
profiles: List[str] = [],
2022-05-18 17:28:18 +02:00
) -> None:
2022-05-14 19:15:31 +02:00
self._name = name
self._image = image
self._ports = ports
self._networks = networks
self._volumes = volumes
self._depends_on = depends_on
self._links = links
self._extends = extends
2022-06-06 18:34:18 +02:00
self._cgroup_parent = cgroup_parent
self._container_name = container_name
self._devices = devices
self._env_file = env_file
self._expose = expose
self._profiles = profiles
2022-05-14 19:15:31 +02:00
@property
def name(self):
return self._name
2022-05-14 20:27:33 +02:00
2022-05-14 19:15:31 +02:00
@property
def image(self):
return self._image
@property
def ports(self):
return self._ports
@property
def networks(self):
return self._networks
@property
def volumes(self):
return self._volumes
@property
def depends_on(self):
return self._depends_on
@property
def links(self):
return self._links
@property
def extends(self):
return self._extends
2022-06-06 18:34:18 +02:00
@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