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 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 WithProfileFile(file string) Option
- func WithTimeout(d time.Duration) Option
- func WithWorkspaceID(id string) Option
- func WithoutProfileResolution() 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 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_NAME.
func WithProfileFile ¶
WithProfileFile returns an Option that sets the profile file to use for profile resolution. By default, the profile file is resolved from the environment variable $DATABRICKS_CONFIG_FILE.
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 WithoutProfileResolution ¶
func WithoutProfileResolution() Option
WithoutProfileResolution returns an Option that entirely disables profile resolution. This is useful when you want your client to only be explicitly configured in code.