localconfig

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigDir added in v0.3.2

func DefaultConfigDir() (string, error)

DefaultConfigDir returns the local configuration path for settings such as cached authentication tokens.

func DefaultLocalConfigPath

func DefaultLocalConfigPath() (string, error)

DefaultLocalConfigPath returns the local configuration path for settings such as cached authentication tokens.

func ValidateLocalConfig

func ValidateLocalConfig(config LocalConfig) error

func WriteLocalConfig

func WriteLocalConfig(config LocalConfig, configPath string) error

WriteLocalConfig writes a new local configuration file.

Types

type Context

type Context struct {
	Name   string
	Server Server
	User   User
}

Context is the resolved Server and User objects resolved

type ContextRef

type ContextRef struct {
	Name   string `json:"name"`
	Server string `json:"server"`
	User   string `json:"user"`
}

ContextRef is a reference to a Server and User for an API client

type LocalConfig

type LocalConfig struct {
	CurrentContext string       `json:"current-context"`
	Contexts       []ContextRef `json:"contexts"`
	Servers        []Server     `json:"servers"`
	Users          []User       `json:"users"`
}

LocalConfig is a local ArgoCD config file

func ReadLocalConfig

func ReadLocalConfig(path string) (*LocalConfig, error)

ReadLocalConfig loads up the local configuration file. Returns nil if config does not exist

func (*LocalConfig) GetServer

func (l *LocalConfig) GetServer(name string) (*Server, error)

func (*LocalConfig) GetUser

func (l *LocalConfig) GetUser(name string) (*User, error)

func (*LocalConfig) ResolveContext

func (l *LocalConfig) ResolveContext(name string) (*Context, error)

ResolveContext resolves the specified context. If unspecified, resolves the current context

func (*LocalConfig) UpsertContext

func (l *LocalConfig) UpsertContext(context ContextRef)

func (*LocalConfig) UpsertServer

func (l *LocalConfig) UpsertServer(server Server)

func (*LocalConfig) UpsertUser

func (l *LocalConfig) UpsertUser(user User)

type Server

type Server struct {
	// Server is the ArgoCD server address
	Server string `json:"server"`
	// Insecure indicates to connect to the server over TLS insecurely
	Insecure bool `json:"insecure,omitempty"`
	// CACertificateAuthorityData is the base64 string of a PEM encoded certificate
	// TODO: not yet implemented
	CACertificateAuthorityData string `json:"certificate-authority-data,omitempty"`
	// PlainText indicates to connect with TLS disabled
	PlainText bool `json:"plain-text,omitempty"`
}

Server contains ArgoCD server information

type User

type User struct {
	Name         string `json:"name"`
	AuthToken    string `json:"auth-token,omitempty"`
	RefreshToken string `json:"refresh-token,omitempty"`
}

User contains user authentication information

Jump to

Keyboard shortcuts

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