Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionPath   = "%s/version"
	LoginPath     = "%s/login?cli=true"
	RedirectPath  = "%s/spaces"
	AccessKeyPath = "%s/profile/access-keys"
	RefreshToken  = time.Minute * 30
)

Variables

View Source
var CacheFolder string
View Source
var DefaultCacheConfig string
View Source
var ErrAccessKeyNotFound = fmt.Errorf("platform access key not found. Login again")

Copied from platform `pkg/authentication/registry.go`.

Functions

func GetKubeConfig

func GetKubeConfig(host, token, namespace string, insecure bool) clientcmd.ClientConfig

func GetRestConfig

func GetRestConfig(host, token string, insecure bool) (*rest.Config, error)

func VerifyVersion

func VerifyVersion(baseClient Client) error

VerifyVersion checks if the Loft version is compatible with this CLI version.

Types

type Client

type Client interface {
	Management() (kube.Interface, error)
	ManagementConfig() (*rest.Config, error)
	RefreshSelf(ctx context.Context) error
	Self() *managementv1.Self

	Login(host string, insecure bool) error
	LoginWithAccessKey(host, accessKey string, insecure bool, force bool) error
	LoginRaw(host, accessKey string, insecure bool) error

	Logout(ctx context.Context) error

	Version() (*auth.Version, error)
	Config() *Config
	Save() error
}

func InitClientFromPath

func InitClientFromPath(ctx context.Context, path string) (Client, error)

func NewClient

func NewClient() Client

func NewClientFromConfig

func NewClientFromConfig(c *Config) Client

func NewClientFromPath

func NewClientFromPath(path string) (Client, error)

type Config

type Config struct {
	metav1.TypeMeta `json:",inline"`

	// host is the http endpoint of how to access loft
	// +optional
	Host string `json:"host,omitempty"`

	// LastInstallContext is the last install context
	// +optional
	LastInstallContext string `json:"lastInstallContext,omitempty"`

	// insecure specifies if the loft instance is insecure
	// +optional
	Insecure bool `json:"insecure,omitempty"`

	// access key is the access key for the given loft host
	// +optional
	AccessKey string `json:"accesskey,omitempty"`

	// virtual cluster access key is the access key for the given loft host to create virtual clusters
	// +optional
	VirtualClusterAccessKey string `json:"virtualClusterAccessKey,omitempty"`

	// map of cached certificates for "access point" mode virtual clusters
	// +optional
	VirtualClusterAccessPointCertificates map[string]VirtualClusterCertificatesEntry
}

Config defines the client config structure.

func NewConfig

func NewConfig() *Config

NewConfig creates a new config.

type VirtualClusterCertificatesEntry

type VirtualClusterCertificatesEntry struct {
	CertificateData string
	KeyData         string
	LastRequested   metav1.Time
	ExpirationTime  time.Time
}

Jump to

Keyboard shortcuts

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