def one_of_host_port_or_account_id_is_required(cls, values): host_port = values.get("host_port") if host_port is not None: logger.warning( "snowflake's `host_port` option has been deprecated; use account_id instead" ) host_port = remove_protocol(host_port) host_port = remove_trailing_slashes(host_port) host_port = remove_suffix(host_port, ".snowflakecomputing.com") values["host_port"] = host_port account_id = values.get("account_id") if account_id is None: if host_port is None: raise ConfigurationError( "One of account_id (recommended) or host_port (deprecated) is required" ) else: values["account_id"] = host_port return values
def clean_host_port(cls, v): return config_clean.remove_protocol(v)
def test_remove_protocol_http_accidental_multiple(): assert (config_clean.remove_protocol("http://http://www.example.com") == "www.example.com")
def test_remove_protocol_http(): assert config_clean.remove_protocol( "http://www.example.com") == "www.example.com"
def test_remove_protocol_https(): assert config_clean.remove_protocol( "https://localhost:3000") == "localhost:3000"
def host_port_is_valid(cls, v, values, **kwargs): v = remove_protocol(v) v = remove_trailing_slashes(v) v = remove_suffix(v, ".snowflakecomputing.com") return v
def host_port_is_valid(cls, v, values, **kwargs): v = remove_protocol(v) v = remove_trailing_slashes(v) v = remove_suffix(v, ".snowflakecomputing.com") logger.info(f"Cleaned Host port is {v}") return v