client

package
v0.5.12-alpha.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MPL-2.0 Imports: 28 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 = ".loft"
View Source
var DefaultCacheConfig = "config.json"

DefaultCacheConfig is the path to the config

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, log log.Logger) error
	LoginWithAccessKey(host, accessKey string, insecure 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