config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthType

type AuthType string
const (
	AuthTypeFederation     AuthType = "federation"
	AuthTypeServiceAccount AuthType = "service account"
)

type Config

type Config struct {
	Default  string         `yaml:"default,omitempty"`
	Profiles ProfilesConfig `yaml:"profiles"`
}

func NewConfig

func NewConfig() *Config

func (*Config) GetDefaultProfile

func (c *Config) GetDefaultProfile() (*Profile, error)

func (*Config) GetProfile

func (c *Config) GetProfile(name string) (*Profile, error)

func (*Config) HasProfile

func (c *Config) HasProfile(name string) bool

type ConfigInterface

type ConfigInterface interface {
	ParentID() string
	TenantID() string
	Endpoint() string
	GetCredentials(context.Context) (auth.BearerTokener, error)
	GetAuthType() AuthType
	SetOptions(options ...Option)
	GetConfig() *Config
	GetConfigPath() (string, error)
	Load(context.Context) error
	LoadIfNeeded(context.Context) error
	CurrentProfileName() string
}

type Error

type Error struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type GetProfileError

type GetProfileError struct {
	// contains filtered or unexported fields
}

func NewGetProfileError

func NewGetProfileError(err error, profiles ProfilesConfig) *GetProfileError

func (*GetProfileError) AvailableProfiles

func (e *GetProfileError) AvailableProfiles() []string

func (*GetProfileError) Error

func (e *GetProfileError) Error() string

func (*GetProfileError) Unwrap

func (e *GetProfileError) Unwrap() error

type MissingConfigError

type MissingConfigError struct {
	// contains filtered or unexported fields
}

func NewMissingConfigError

func NewMissingConfigError(err error) *MissingConfigError

func (*MissingConfigError) Error

func (e *MissingConfigError) Error() string

func (*MissingConfigError) Unwrap

func (e *MissingConfigError) Unwrap() error

type Option

type Option interface {
	// contains filtered or unexported methods
}

type Profile

type Profile struct {
	Name string `yaml:"-"`

	Endpoint           string   `yaml:"endpoint,omitempty"`
	TokenFile          string   `yaml:"token-file,omitempty"`
	TokenEndpoint      string   `yaml:"token-endpoint,omitempty"`
	AuthType           AuthType `yaml:"auth-type,omitempty"`
	FederationEndpoint string   `yaml:"federation-endpoint,omitempty"`
	FederationID       string   `yaml:"federation-id,omitempty"`
	// TODO: move the following 4 values to a nested struct (config command doesn't support that)
	ServiceAccountID string `yaml:"service-account-id,omitempty"`
	PublicKeyID      string `yaml:"public-key-id,omitempty"`
	//nolint:gosec // This is up to a user to decide whether to put a private key in config or not.
	PrivateKey string `yaml:"private-key,omitempty"`
	// PrivateKeyFilePath points to a file containing a PEM encoded PKCS1 or PKCS8 private key.
	PrivateKeyFilePath string `yaml:"private-key-file-path,omitempty"`
	// ServiceAccountCredentialsFilePath points to a JSON credentials file that already
	// contains service account ID, public key ID and private key (see auth.ServiceAccountCredentialsFileParser format).
	ServiceAccountCredentialsFilePath string `yaml:"service-account-credentials-file-path,omitempty"`
	// Federated credentials log-in path
	FederatedSubjectCredentialsFilePath string `yaml:"federated-subject-credentials-file-path,omitempty"`

	ParentID string `yaml:"parent-id,omitempty"`
	TenantID string `yaml:"tenant-id,omitempty"`
}

func (*Profile) LogValue

func (p *Profile) LogValue() slog.Value

type ProfilesConfig

type ProfilesConfig map[string]*Profile

type StubOption

type StubOption struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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