compose-viz/compose_viz/models/port.py

47 lines
901 B
Python
Raw Normal View History

2022-05-21 17:19:01 +02:00
from enum import Enum
class Protocol(str, Enum):
tcp = "tcp"
udp = "udp"
2022-05-24 10:02:47 +02:00
any = "any"
2022-05-21 17:19:01 +02:00
2024-04-27 18:42:34 +02:00
class AppProtocol(str, Enum):
rest = "REST"
mqtt = "MQTT"
wbsock = "WebSocket"
http = "http"
https = "https"
na = "NA"
2022-05-21 17:19:01 +02:00
class Port:
2024-04-27 18:42:34 +02:00
def __init__(
self,
host_port: str,
container_port: str,
protocol: Protocol = Protocol.any,
app_protocol: AppProtocol = AppProtocol.na,
):
2022-05-21 17:19:01 +02:00
self._host_port = host_port
self._container_port = container_port
self._protocol = protocol
2024-04-27 18:42:34 +02:00
self._app_protocol = app_protocol
2022-05-21 17:19:01 +02:00
@property
def host_port(self):
return self._host_port
@property
def container_port(self):
return self._container_port
@property
def protocol(self):
return self._protocol
2024-04-27 18:42:34 +02:00
@property
def app_protocol(self):
return self._app_protocol