client

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RecommendedHomeDir is the default name for the osprey home directory.
	RecommendedHomeDir = ".osprey"
	// RecommendedFileName is the default name for the osprey config file.
	RecommendedFileName = "config"
)

Variables

View Source
var (
	// HomeDir is the user's home directory.
	HomeDir = homeDir()
	// RecommendedOspreyHomeDir is the default full path for the osprey home.
	RecommendedOspreyHomeDir = path.Join(HomeDir, RecommendedHomeDir)
	// RecommendedOspreyConfigFile is the default full path for the osprey config file.
	RecommendedOspreyConfigFile = path.Join(RecommendedOspreyHomeDir, RecommendedFileName)
)

Functions

func SaveConfig

func SaveConfig(config *Config, path string) error

SaveConfig serializes the osprey config to the specified path.

Types

type Client

type Client interface {
	// GetAccessToken returns an access token that is required to authenticate user access against a kubernetes cluster
	GetAccessToken(*LoginCredentials) (*kubeconfig.TokenInfo, error)
}

Client is used to authenticate and generate the configuration

func NewClient

func NewClient(host string, serverCAs ...string) Client

NewClient creates a new Client

type Config

type Config struct {
	// CertificateAuthority is the path to a cert file for the certificate authority.
	// +optional
	CertificateAuthority string `yaml:"certificate-authority,omitempty"`
	// CertificateAuthorityData is base64-encoded CA cert data.
	// This will override any cert file specified in CertificateAuthority.
	// +optional
	CertificateAuthorityData string `yaml:"certificate-authority-data,omitempty"`
	// Kubeconfig specifies the path to read/write the kubeconfig file
	// +optional
	Kubeconfig string `yaml:"kubeconfig,omitempty"`
	// Ospreys is a map of referenceable names to osprey configs
	Targets map[string]*Osprey `yaml:"targets"`
}

Config holds the information needed to connect to remote osprey servers as a given user

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads an osprey Config from the specified path.

func NewConfig

func NewConfig() *Config

NewConfig is a convenience function that returns a new Config object with non-nil maps

type LoginCredentials

type LoginCredentials struct {
	// Username username of user intending to login
	Username string
	// Password the password for user
	Password string
}

LoginCredentials represents user credentials

func GetCredentials

func GetCredentials() (*LoginCredentials, error)

GetCredentials loads the credentials from the terminal or stdin.

type Osprey

type Osprey struct {
	// Server is the address of the osprey server (hostname:port).
	Server string `yaml:"server"`
	// CertificateAuthority is the path to a cert file for the certificate authority.
	// +optional
	CertificateAuthority string `yaml:"certificate-authority,omitempty"`
	// CertificateAuthorityData is base64-encoded CA cert data.
	// This will override any cert file specified in CertificateAuthority.
	// +optional
	CertificateAuthorityData string   `yaml:"certificate-authority-data,omitempty"`
	Aliases                  []string `yaml:"aliases,omitempty"`
}

Osprey contains information about how to communicate with an osprey server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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