def update_host()

in modular_sdk/services/impl/maestro_credentials_service.py [0:0]


    def update_host(self, host: Optional[str] = None,
                    port: Optional[int] = None,
                    protocol: Optional[str] = None,
                    stage: Optional[str] = None):
        """
        Use ONLY this method to update attributes
        :param host:
        :param port:
        :param protocol:
        :param stage:
        :return:
        """
        parsed: Url = parse_url(host)  # works with None
        _host = parsed.host
        _port = port or parsed.port or 443  # 443 default
        _stage = stage or parsed.path
        _protocol = protocol or parsed.scheme or \
                    (HTTPS_ATTR if _port == 443 else HTTP_ATTR)

        if _host:
            self.host = _host
        if _port:
            self.port = _port
        if _stage:
            self.stage = _stage.strip('/')
        if _protocol:
            self.protocol = _protocol.upper()