Documentation ¶
Index ¶
- Constants
- Variables
- func AskForApiKey() (string, error)
- func AskForUrl(defaultUrl string) (string, error)
- func AskForUserNameAndPassword(userName, password string) (string, string, error)
- func AskIfOpenBrowser() (bool, error)
- func AskIfUseLogin() (bool, error)
- func CheckLoggedIn() error
- func EnvNameFromUrl(url string) string
- func GetWhoami(ctx context.Context) (*tensorleapapi.UserData, error)
- func IsApiBaseUrlSet() bool
- func IsLocalUrl(url string) bool
- func Login(env *Env) (err error)
- func LoginAndGetAuthToken(apiUrl, username, password string) (string, error)
- func LoginAndGetAuthTokenWithBrowser(ctx context.Context, apiUrl string) (string, error)
- func Logout(envName string) error
- func NormalizeAPIUrl(url string) string
- func PrintWhoami(ctx context.Context) error
- func SelectAndSetEnv(envName string) error
- type ApiKeyResponse
- type Env
- type TokenResponse
Constants ¶
View Source
const ( API_URL = "api_url" API_KEY = "api_key" ENV_NAME = "name" ENVIRONMENTS_CONFIG_PATH = "envs" AUTH_CONFIG_PATH = "auth" CURRENT_ENV = "current_env" )
View Source
const API_PATH = "/api/v2"
Variables ¶
View Source
var ( // just for backward compatibility, will use just current_env and envs in the future API_KEY_CONFIG_PATH = getAuthPath(API_KEY) API_URL_CONFIG_PATH = getAuthPath(API_URL) )
View Source
var ErrNotLoggedIn = fmt.Errorf("not logged in")
Functions ¶
func AskForApiKey ¶ added in v0.0.74
func AskForUserNameAndPassword ¶ added in v0.0.74
func AskIfOpenBrowser ¶ added in v0.0.74
func AskIfUseLogin ¶ added in v0.0.74
func CheckLoggedIn ¶
func CheckLoggedIn() error
func EnvNameFromUrl ¶ added in v0.0.43
func GetWhoami ¶ added in v0.0.43
func GetWhoami(ctx context.Context) (*tensorleapapi.UserData, error)
func IsApiBaseUrlSet ¶
func IsApiBaseUrlSet() bool
func IsLocalUrl ¶ added in v0.0.45
func LoginAndGetAuthToken ¶ added in v0.0.74
func LoginAndGetAuthTokenWithBrowser ¶ added in v0.0.74
func NormalizeAPIUrl ¶ added in v0.0.74
func PrintWhoami ¶ added in v0.0.43
func SelectAndSetEnv ¶ added in v0.0.43
Types ¶
type ApiKeyResponse ¶ added in v0.0.74
type ApiKeyResponse struct {
ApiKey string `json:"apiKey"`
}
the response is a json with key apiToken
type Env ¶ added in v0.0.43
func GetCurrentEnv ¶ added in v0.0.43
func GetCurrentEnv() *Env
func GetEnvAuth ¶ added in v0.0.43
func (*Env) AuthContext ¶ added in v0.0.43
Click to show internal directories.
Click to hide internal directories.