예제 #1
0
def configure(version):
    profile = get_profile_from_context()
    config = ProfileConfigProvider(
        profile).get_config() if profile else get_config()
    new_config = config or DatabricksConfig.empty()
    new_config.jobs_api_version = version
    update_and_persist_config(profile, new_config)
예제 #2
0
def configure_cli(token, aad_token, insecure, host, token_file,
                  jobs_api_version, oauth, scope):
    """
    Configures host, authentication, and jobs-api version for the CLI.
    """
    profile = get_profile_from_context()
    insecure_str = str(insecure) if insecure is not None else None

    if token:
        _configure_cli_token(profile=profile,
                             insecure=insecure_str,
                             host=host,
                             jobs_api_version=jobs_api_version)
    elif token_file:
        _configure_cli_token_file(profile=profile,
                                  insecure=insecure_str,
                                  host=host,
                                  token_file=token_file,
                                  jobs_api_version=jobs_api_version)
    elif oauth:
        _configure_cli_oauth(profile=profile,
                             insecure=insecure_str,
                             host=host,
                             scope=scope,
                             jobs_api_version=jobs_api_version)
    elif aad_token:
        _configure_cli_aad_token(profile=profile,
                                 insecure=insecure_str,
                                 host=host,
                                 jobs_api_version=jobs_api_version)
    else:
        _configure_cli_password(profile=profile,
                                insecure=insecure_str,
                                host=host,
                                jobs_api_version=jobs_api_version)
예제 #3
0
def configure_cli(token):
    """
    Configures host and authentication info for the CLI.
    """
    profile = get_profile_from_context()
    if token:
        _configure_cli_token(profile)
    else:
        _configure_cli_password(profile)
예제 #4
0
def configure_cli(token, insecure):
    """
    Configures host and authentication info for the CLI.
    """
    profile = get_profile_from_context()
    insecure_str = str(insecure) if insecure is not None else None
    if token:
        _configure_cli_token(profile, insecure_str)
    else:
        _configure_cli_password(profile, insecure_str)
예제 #5
0
def setup(token, insecure):
    """
    Configures host and authentication info for the Databricks CLI.
    """
    profile = get_profile_from_context()
    insecure_str = str(insecure) if insecure is not None else None
    if token:
        _configure_cli_token(profile, insecure_str)

    return None
예제 #6
0
 def decorator(*args, **kwargs):
     ctx = click.get_current_context()
     command_name = "-".join(ctx.command_path.split(" ")[1:])
     command_name += "-" + str(uuid.uuid1())
     profile = get_profile_from_context()
     if profile:
         # If we request a specific profile, only get credentials from tere.
         config = ProfileConfigProvider(profile).get_config()
     else:
         raise ValueError("Please provide profile field")
     if not config or not config.is_valid:
         raise InvalidConfigurationError.for_profile(profile)
     os.environ["DATABRICKS_HOST"] = config.host
     os.environ["DATABRICKS_TOKEN"] = config.token
     return function(*args, **kwargs)
예제 #7
0
파일: cli.py 프로젝트: Men0x/aobd_project
def configure_cli(token, aad_token, insecure, host, token_file):
    """
    Configures host and authentication info for the CLI.
    """
    profile = get_profile_from_context()
    insecure_str = str(insecure) if insecure is not None else None

    if token:
        _configure_cli_token(profile=profile, insecure=insecure_str, host=host)
    elif token_file:
        _configure_cli_token_file(profile=profile, insecure=insecure_str, host=host,
                                  token_file=token_file)
    elif aad_token:
        _configure_cli_aad_token(profile=profile, insecure=insecure_str, host=host)
    else:
        _configure_cli_password(profile=profile, insecure=insecure_str, host=host)