pub struct DatabricksBuilder { /* private fields */ }Expand description
Builder for Databricks authentication configuration.
Auth resolution order (when no auth_type is forced):
- Explicit
with_credentials(provider)override. - PAT / static token (
DATABRICKS_TOKEN/with_token()). - OAuth M2M (
DATABRICKS_CLIENT_ID+DATABRICKS_CLIENT_SECRET). env-oidc— OIDC token from env var (DATABRICKS_OIDC_TOKEN_ENV, defaultDATABRICKS_OIDC_TOKEN).file-oidc— OIDC token from file (DATABRICKS_OIDC_TOKEN_FILEPATH).- Azure MSI fallback (if
DATABRICKS_AZURE_RESOURCE_IDis set). - GCP service account token exchange (if
GOOGLE_APPLICATION_CREDENTIALSis set).
If DATABRICKS_AUTH_TYPE is set (or with_auth_type() called), only the named
auth type is attempted; an error is returned immediately if its required fields are absent.
.databrickscfg profile values are loaded as the lowest-priority source — env vars
and code-level setters override them.
Implementations§
Source§impl DatabricksBuilder
impl DatabricksBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new DatabricksBuilder with default values.
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Populate from environment variables and optionally a .databrickscfg profile.
Profile values from .databrickscfg (or DATABRICKS_CONFIG_FILE) are loaded first
as the lowest-priority source. Environment variables override profile values.
Variables read: DATABRICKS_HOST, DATABRICKS_TOKEN, DATABRICKS_CLIENT_ID,
DATABRICKS_CLIENT_SECRET, DATABRICKS_ACCOUNT_ID, DATABRICKS_AZURE_RESOURCE_ID,
DATABRICKS_OAUTH_SCOPE, DATABRICKS_CONFIG_FILE, DATABRICKS_CONFIG_PROFILE,
DATABRICKS_AUTH_TYPE, DATABRICKS_OIDC_TOKEN_ENV, DATABRICKS_OIDC_TOKEN_FILEPATH,
GOOGLE_APPLICATION_CREDENTIALS.
Sourcepub fn with_config(
self,
key: DatabricksConfigKey,
value: impl Into<String>,
) -> Self
pub fn with_config( self, key: DatabricksConfigKey, value: impl Into<String>, ) -> Self
Set an option via a key-value pair.
Sourcepub fn with_credentials(
self,
credentials: Arc<dyn CredentialProvider<Credential = DatabricksCredential>>,
) -> Self
pub fn with_credentials( self, credentials: Arc<dyn CredentialProvider<Credential = DatabricksCredential>>, ) -> Self
Override credential resolution with a custom provider.
Sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Set a static PAT or bearer token.
Sourcepub fn with_auth_type(self, auth_type: impl Into<String>) -> Self
pub fn with_auth_type(self, auth_type: impl Into<String>) -> Self
Force a specific auth type (e.g. "pat", "oauth-m2m", "env-oidc", "file-oidc").
Sourcepub fn with_oidc_token_env(self, env_var: impl Into<String>) -> Self
pub fn with_oidc_token_env(self, env_var: impl Into<String>) -> Self
Set the env var name that holds an OIDC token (default: DATABRICKS_OIDC_TOKEN).
Sourcepub fn with_oidc_token_filepath(self, path: impl Into<String>) -> Self
pub fn with_oidc_token_filepath(self, path: impl Into<String>) -> Self
Set the file path to an OIDC token.
Sourcepub fn with_retry(self, retry_config: RetryConfig) -> Self
pub fn with_retry(self, retry_config: RetryConfig) -> Self
Set the retry configuration.
Sourcepub fn with_client_options(self, options: ClientOptions) -> Self
pub fn with_client_options(self, options: ClientOptions) -> Self
Set the HTTP client options.
Sourcepub fn build(self, runtime: Option<&Handle>) -> Result<DatabricksConfig>
pub fn build(self, runtime: Option<&Handle>) -> Result<DatabricksConfig>
Build a DatabricksConfig.
If runtime is provided, HTTP I/O for credential refresh is spawned on that runtime.
Trait Implementations§
Source§impl Clone for DatabricksBuilder
impl Clone for DatabricksBuilder
Source§fn clone(&self) -> DatabricksBuilder
fn clone(&self) -> DatabricksBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more