Example #1
0
 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
Example #2
0
 def clean_host_port(cls, v):
     return config_clean.remove_protocol(v)
Example #3
0
def test_remove_protocol_http_accidental_multiple():
    assert (config_clean.remove_protocol("http://http://www.example.com") ==
            "www.example.com")
Example #4
0
def test_remove_protocol_http():
    assert config_clean.remove_protocol(
        "http://www.example.com") == "www.example.com"
Example #5
0
def test_remove_protocol_https():
    assert config_clean.remove_protocol(
        "https://localhost:3000") == "localhost:3000"
Example #6
0
 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
Example #7
0
 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