auth

package
v0.2.46-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIKeyCallbackFunc = WaitForAPIKeyCallback

APIKeyCallbackFunc is a variable that holds the function for retrieving API keys. This can be overridden in tests to mock the browser-based authentication flow.

View Source
var ErrEnvCredentialsNotSet = errors.New("environment credentials not set")

ErrEnvCredentialsNotSet is returned when environment credentials are not fully configured.

Functions

func EnsureAuthenticated

func EnsureAuthenticated(ctx context.Context) bool

EnsureAuthenticated checks if valid authentication exists, and if not, triggers the login flow automatically. Returns true if authentication is valid or was successfully obtained.

func EnsureAuthenticatedE

func EnsureAuthenticatedE(cmd *cobra.Command, _ []string) error

EnsureAuthenticatedE checks if valid authentication exists, and if not, triggers the login flow automatically. Returns an error if authentication fails, suitable for use in Cobra PreRunE hooks.

func GetBaseURLOrAsk added in v0.2.30

func GetBaseURLOrAsk() string

func SetURLAction

func SetURLAction() bool

func WaitForAPIKeyCallback

func WaitForAPIKeyCallback(ctx context.Context, datarobotHost string) (string, error)

func WriteConfigFile

func WriteConfigFile() error

func WriteConfigFileSilent

func WriteConfigFileSilent() error

Types

type EnvCredentials added in v0.2.43

type EnvCredentials struct {
	Endpoint string
	Token    string
}

EnvCredentials holds environment variable authentication credentials.

func GetEnvCredentials added in v0.2.43

func GetEnvCredentials() EnvCredentials

GetEnvCredentials reads DATAROBOT_ENDPOINT and DATAROBOT_API_TOKEN from environment. Falls back to DATAROBOT_API_ENDPOINT if DATAROBOT_ENDPOINT is not set.

func VerifyEnvCredentials added in v0.2.43

func VerifyEnvCredentials() (*EnvCredentials, error)

VerifyEnvCredentials checks if environment variable credentials are valid. Returns credentials and nil error if valid, credentials and error otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL