Documentation
¶
Index ¶
- Variables
- func EnsureAuthenticated(ctx context.Context) bool
- func EnsureAuthenticatedE(cmd *cobra.Command, _ []string) error
- func GetBaseURLOrAsk() string
- func PrintUnsetTokenInstructions()
- func SetURLAction() bool
- func WaitForAPIKeyCallback(ctx context.Context, datarobotHost string) (string, error)
- func WriteConfigFile() error
- func WriteConfigFileSilent() error
- type EnvCredentials
Constants ¶
This section is empty.
Variables ¶
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.
var ErrEnvCredentialsNotSet = errors.New("environment credentials not set")
ErrEnvCredentialsNotSet is returned when environment credentials are not fully configured.
Functions ¶
func EnsureAuthenticated ¶
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 ¶
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 PrintUnsetTokenInstructions ¶ added in v0.2.49
func PrintUnsetTokenInstructions()
PrintUnsetTokenInstructions prints platform-specific instructions for unsetting DATAROBOT_API_TOKEN.
func SetURLAction ¶
func SetURLAction() bool
func WaitForAPIKeyCallback ¶
func WriteConfigFile ¶
func WriteConfigFile() error
func WriteConfigFileSilent ¶
func WriteConfigFileSilent() error
Types ¶
type EnvCredentials ¶ added in v0.2.43
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.