auth

package
v0.0.63 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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"
)

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 CheckLoggedIn

func CheckLoggedIn() error

func EnvNameFromUrl added in v0.0.43

func EnvNameFromUrl(url string) string

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 IsLocalUrl(url string) bool

func Login

func Login(env *Env) (err error)

func Logout

func Logout(envName string) error

func PrintWhoami added in v0.0.43

func PrintWhoami(ctx context.Context) error

func SelectAndSetEnv added in v0.0.43

func SelectAndSetEnv(envName string) error

Types

type Env added in v0.0.43

type Env struct {
	Name   string
	ApiUrl string
	ApiKey string
}

func GetCurrentEnv added in v0.0.43

func GetCurrentEnv() *Env

func GetEnvAuth added in v0.0.43

func GetEnvAuth(name string) (*Env, error)

func GetEnvs added in v0.0.43

func GetEnvs() []Env

func NewEnv added in v0.0.43

func NewEnv(name, apiUrl, apiKey string) *Env

func SelectEnv added in v0.0.43

func SelectEnv(msg string, envName string) (*Env, error)

func (*Env) AuthContext added in v0.0.43

func (a *Env) AuthContext(ctx context.Context) context.Context

func (*Env) PrintWhoami added in v0.0.43

func (a *Env) PrintWhoami(ctx context.Context) error

Jump to

Keyboard shortcuts

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