Documentation
¶
Overview ¶
Package client defines the options used to configure Databricks API clients.
Databricks API clients can resolve their options from a variety of sources:
- Profile from file or default. - Environment variables override. - Explicit value override.
If no credentials are provided, the credentials are automatically resolved from the client configuration after the above chain of resolution.
In practice, we recommend users to stick to a single resolution level. That is either rely purely on automatic resolution from the environment or explicitly set all options in code. Mixing the two approaches is not recommended.
Index ¶
- type Option
- func WithAccountID(id string) Option
- func WithConfigFile(file string) Option
- func WithCredentials(creds auth.Credentials) Option
- func WithHTTPClient(hc *http.Client) Option
- func WithHost(h string) Option
- func WithLogger(l *slog.Logger) Option
- func WithProfile(name string) Option
- func WithTimeout(d time.Duration) Option
- func WithWorkspaceID(id string) Option
- func WithoutConfigFile() Option
- func WithoutEnv() Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*internaloptions.ClientOptions) error
Option configures a Databricks API client.
func WithAccountID ¶
WithAccountID returns an Option that sets the account ID for the client.
func WithConfigFile ¶
WithConfigFile returns an Option that sets the config file to use for profile resolution. By default, the config file is resolved from the environment variable $DATABRICKS_CONFIG_FILE.
func WithCredentials ¶
func WithCredentials(creds auth.Credentials) Option
WithCredentials returns an Option that sets a specific credentials.
func WithHTTPClient ¶
WithHTTPClient returns an Option that uses a specific HTTP client when making HTTP requests.
Important: When set, this option ignores all other options.
func WithLogger ¶
WithLogger returns an Option that uses the provided logger. Log messages are only logged if the logger is enabled.
func WithProfile ¶
WithProfile returns an Option that sets the profile name to use for profile resolution. By default, the profile name is resolved from the environment variable $DATABRICKS_CONFIG_PROFILE.
func WithTimeout ¶
WithTimeout returns an Option that sets the overall API call timeout to the given duration by default.
func WithWorkspaceID ¶
WithWorkspaceID returns an Option that sets the workspace ID for the client.
func WithoutConfigFile ¶
func WithoutConfigFile() Option
WithoutConfigFile returns an Option that disables loading client configuration from a config file. It cannot be combined with WithConfigFile or WithProfile.
func WithoutEnv ¶
func WithoutEnv() Option
WithoutEnv returns an Option that disables overlaying client configuration from environment variables. It does not affect DATABRICKS_CONFIG_FILE or DATABRICKS_CONFIG_PROFILE, which select the profile file and name.