Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewM2MCredentials ¶
func NewM2MCredentials(opts M2MOptions) (auth.TokenProvider, error)
NewM2MCredentials returns an auth.TokenProvider that fetches OAuth 2.0 access tokens using the client credentials grant.
The returned provider does not cache tokens or retry on failure. Wrap it with auth.NewCachedTokenProvider and [retrying.NewTokenProvider] as needed.
func NewPATCredentials ¶
func NewPATCredentials(token string) (auth.Credentials, error)
NewPATCredentials returns a Credentials that can be used to authenticate with a Personal Access Token.
func NewU2MCredentials ¶
func NewU2MCredentials(opts U2MOptions) (auth.TokenProvider, error)
NewU2MCredentials returns an auth.TokenProvider that obtains tokens by shelling out to the Databricks CLI.
The returned provider does not cache tokens or retry on failure. Wrap it with auth.NewCachedTokenProvider and [retrying.NewTokenProvider] as needed.
Types ¶
type M2MOptions ¶
type M2MOptions struct {
// ClientID is the OAuth client ID (service principal application ID).
// Required.
ClientID string
// ClientSecret is the OAuth client secret. Required.
ClientSecret string
// Host is the Databricks workspace or account URL (for example,
// "https://example.cloud.databricks.com"). Required.
Host string
// Scopes overrides the OAuth scopes requested for the token. If empty,
// defaults to ["all-apis"].
Scopes []string
// HTTPClient is the HTTP client used for OIDC endpoint discovery and
// for the OAuth token exchange. If nil, [http.DefaultClient] is used.
HTTPClient *http.Client
}
M2MOptions configures a machine-to-machine (OAuth 2.0 client credentials) auth.TokenProvider.
type U2MOptions ¶
type U2MOptions struct {
// Profile is the databricks CLI profile name. When set, the CLI is
// invoked with --profile. Host, when also set, is used as a fallback
// for older CLI versions that do not support --profile.
Profile string
// Host is the workspace or account URL. Required when Profile is empty.
Host string
// AccountID is passed as --account-id when invoking the CLI via --host
// for account-level hosts. Optional.
AccountID string
// CLIPath overrides the "databricks" binary to execute. If empty, the
// binary is looked up in PATH.
CLIPath string
}
U2MOptions configures a user-to-machine auth.TokenProvider that obtains tokens by shelling out to the Databricks CLI. The CLI must already be authenticated (via "databricks auth login"); this provider does not perform an interactive OAuth flow.