localconfig

package
v2.12.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigDir

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 DeleteLocalConfig

func DeleteLocalConfig(configPath string) error

func GetUsername

func GetUsername(subject string) string

Get username from subject in a claim

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 Argo CD 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) IsEmpty

func (l *LocalConfig) IsEmpty() bool

func (*LocalConfig) RemoveContext

func (l *LocalConfig) RemoveContext(serverName string) (string, bool)

Returns true if context was removed successfully

func (*LocalConfig) RemoveServer

func (l *LocalConfig) RemoveServer(serverName string) bool

Returns true if server was removed successfully

func (*LocalConfig) RemoveToken

func (l *LocalConfig) RemoveToken(serverName string) bool

Returns true if user was removed successfully

func (*LocalConfig) RemoveUser

func (l *LocalConfig) RemoveUser(serverName string) bool

Returns true if user was removed successfully

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 Argo CD server address
	Server string `json:"server"`
	// Insecure indicates to connect to the server over TLS insecurely
	Insecure bool `json:"insecure,omitempty"`
	// GRPCWeb indicates to connect to the server using gRPC Web protocol
	GRPCWeb bool `json:"grpc-web,omitempty"`
	// GRPCWebRootPath indicates to connect to the server using gRPC Web protocol with this root path
	GRPCWebRootPath string `json:"grpc-web-root-path"`
	// CACertificateAuthorityData is the base64 string of a PEM encoded certificate
	// TODO: not yet implemented
	CACertificateAuthorityData string `json:"certificate-authority-data,omitempty"`
	// ClientCertificateData is the base64 string of a PEM encoded certificate used to authenticate the client
	ClientCertificateData string `json:"client-certificate-data,omitempty"`
	// ClientCertificateKeyData is the base64 string of a PEM encoded private key of the client certificate
	ClientCertificateKeyData string `json:"client-certificate-key-data,omitempty"`
	// PlainText indicates to connect with TLS disabled
	PlainText bool `json:"plain-text,omitempty"`
	// Core indicates to talk to Kubernetes API without using Argo CD API server
	Core bool `json:"core,omitempty"`
}

Server contains Argo CD 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

func (*User) Claims

func (u *User) Claims() (*jwt.RegisteredClaims, error)

Claims returns the standard claims from the JWT claims

Jump to

Keyboard shortcuts

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