Documentation
¶
Index ¶
- Variables
- func ContextWithEnvironmentGetter(ctx context.Context, getter EnvironmentGetter) context.Context
- type ClientId
- type ClientSecret
- type DefaultEnvironmentGetter
- type DirectoryOverrideEnvironmentGetter
- type EnvironmentGetter
- type EnvironmentId
- type EnvironmentSettings
- type JWT
- type Manager
- func (m *Manager) GetAPIServer() SourcedConfig[string]
- func (m *Manager) GetGRPCQueryServer() SourcedConfig[string]
- func (m *Manager) GetJSONQueryServer() SourcedConfig[string]
- func (m *Manager) SetAPIServer(server SourcedConfig[string])
- func (m *Manager) SetGRPCQueryServer(server SourcedConfig[string])
- func (m *Manager) SetJSONQueryServer(server SourcedConfig[string])
- type ManagerInputs
- type MapEnvironmentGetter
- type ProjectSettings
- type ProjectToken
- type ProjectTokens
- type SourceKind
- type SourcedConfig
- func AddScheme(c SourcedConfig[string]) SourcedConfig[string]
- func GetFirstNonEmpty[T SourcedValueT](configs ...SourcedConfig[T]) SourcedConfig[T]
- func NewFromArg[T SourcedValueT](value T) SourcedConfig[T]
- func NewFromDefault[T SourcedValueT](value T, desc string) SourcedConfig[T]
- func NewFromEnvVar[T ~string](ctx context.Context, key string) SourcedConfig[T]
- func NewFromFile[T SourcedValueT](path string, value T) SourcedConfig[T]
- func NewFromToken[T SourcedValueT](value T, description string) SourcedConfig[T]
- type SourcedValueT
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultSourceKind = SourceKind("default") EnvSourceKind = SourceKind("env") FileSourceKind = SourceKind("file") ArgSourceKind = SourceKind("arg") TokenSourceKind = SourceKind("service") EmptySourceKind = SourceKind("empty") )
Functions ¶
func ContextWithEnvironmentGetter ¶
func ContextWithEnvironmentGetter(ctx context.Context, getter EnvironmentGetter) context.Context
Types ¶
type ClientSecret ¶
type ClientSecret string
type DefaultEnvironmentGetter ¶
type DefaultEnvironmentGetter struct {
EnvironmentGetter
}
func (DefaultEnvironmentGetter) Abs ¶
func (d DefaultEnvironmentGetter) Abs(path string) (string, error)
func (DefaultEnvironmentGetter) Getenv ¶
func (d DefaultEnvironmentGetter) Getenv(key string) string
func (DefaultEnvironmentGetter) Getwd ¶
func (d DefaultEnvironmentGetter) Getwd() (string, error)
type DirectoryOverrideEnvironmentGetter ¶
type DirectoryOverrideEnvironmentGetter struct {
EnvironmentGetter
// contains filtered or unexported fields
}
DirectoryOverrideEnvironmentGetter wraps another EnvironmentGetter but overrides the working directory
func NewDirectoryOverrideEnvironmentGetter ¶
func NewDirectoryOverrideEnvironmentGetter(base EnvironmentGetter, dir string) *DirectoryOverrideEnvironmentGetter
func (*DirectoryOverrideEnvironmentGetter) Abs ¶
func (d *DirectoryOverrideEnvironmentGetter) Abs(path string) (string, error)
func (*DirectoryOverrideEnvironmentGetter) Getenv ¶
func (d *DirectoryOverrideEnvironmentGetter) Getenv(key string) string
func (*DirectoryOverrideEnvironmentGetter) Getwd ¶
func (d *DirectoryOverrideEnvironmentGetter) Getwd() (string, error)
type EnvironmentGetter ¶
type EnvironmentGetter interface {
Getenv(key string) string
Getwd() (string, error)
Abs(path string) (string, error)
}
EnvironmentGetter is an interface for getting environment variables and the current working directory. This can help with testing by making otherwise impure functions pure.
func EnvironmentGetterFromContext ¶
func EnvironmentGetterFromContext(ctx context.Context) EnvironmentGetter
type EnvironmentId ¶ added in v1.2.97
type EnvironmentId string
type EnvironmentSettings ¶ added in v1.2.105
type EnvironmentSettings struct {
Runtime *string `json:"runtime,omitempty" yaml:"runtime,omitempty"`
PlatformVersion *string `json:"platform_version,omitempty" yaml:"platform_version,omitempty"`
Requirements *string `json:"requirements,omitempty" yaml:"requirements,omitempty"`
Dockerfile *string `json:"dockerfile,omitempty" yaml:"dockerfile,omitempty"`
}
func (*EnvironmentSettings) ToProto ¶ added in v1.2.105
func (e *EnvironmentSettings) ToProto(id string) *artifactsv1.EnvironmentSettings
type Manager ¶
type Manager struct {
ClientId SourcedConfig[ClientId]
ClientSecret SourcedConfig[ClientSecret]
EnvironmentId SourcedConfig[string]
Scope SourcedConfig[string]
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(ctx context.Context, inputs *ManagerInputs) (*Manager, error)
func (*Manager) GetAPIServer ¶ added in v1.2.104
func (m *Manager) GetAPIServer() SourcedConfig[string]
func (*Manager) GetGRPCQueryServer ¶ added in v1.2.104
func (m *Manager) GetGRPCQueryServer() SourcedConfig[string]
func (*Manager) GetJSONQueryServer ¶ added in v1.2.104
func (m *Manager) GetJSONQueryServer() SourcedConfig[string]
func (*Manager) SetAPIServer ¶ added in v1.2.104
func (m *Manager) SetAPIServer(server SourcedConfig[string])
func (*Manager) SetGRPCQueryServer ¶ added in v1.2.104
func (m *Manager) SetGRPCQueryServer(server SourcedConfig[string])
func (*Manager) SetJSONQueryServer ¶ added in v1.2.104
func (m *Manager) SetJSONQueryServer(server SourcedConfig[string])
type ManagerInputs ¶ added in v1.2.97
type MapEnvironmentGetter ¶
type MapEnvironmentGetter struct {
EnvironmentGetter
Env map[string]string
Wd string
}
func NewMockEnvironmentGetter ¶
func NewMockEnvironmentGetter( env map[string]string, wd string, ) *MapEnvironmentGetter
func (MapEnvironmentGetter) Getenv ¶
func (m MapEnvironmentGetter) Getenv(key string) string
func (MapEnvironmentGetter) Getwd ¶
func (m MapEnvironmentGetter) Getwd() (string, error)
type ProjectSettings ¶ added in v1.2.105
type ProjectSettings struct {
Project string `json:"project" yaml:"project"`
Environments map[string]*EnvironmentSettings `json:"environments" yaml:"environments"`
LocalDirectory string `json:"localDirectory" yaml:"localDirectory,omitempty"`
ChalkIgnore *string `json:"chalkIgnore,omitempty" yaml:"chalkIgnore,omitempty"`
Filename string `yaml:"filename,omitempty"`
}
func (*ProjectSettings) ToProto ¶ added in v1.2.105
func (settings *ProjectSettings) ToProto() *artifactsv1.ProjectSettings
type ProjectToken ¶
type ProjectToken struct {
Name string `yaml:"name"`
ClientId ClientId `yaml:"clientId"`
ClientSecret ClientSecret `yaml:"clientSecret"`
ValidUntil string `yaml:"validUntil"`
ApiServer string `yaml:"apiServer"`
ActiveEnvironment string `yaml:"activeEnvironment"`
JWT JWT `yaml:"jwt,omitempty"`
}
func GetProjectAuthConfig ¶
type ProjectTokens ¶
type ProjectTokens struct {
Tokens map[string]*ProjectToken `yaml:"tokens,omitempty"`
}
type SourceKind ¶ added in v1.2.97
type SourceKind string
type SourcedConfig ¶
type SourcedConfig[T SourcedValueT] struct { Value T Source string Kind SourceKind }
SourcedConfig represents a configuration value along with information about where it came from
func AddScheme ¶ added in v1.2.104
func AddScheme(c SourcedConfig[string]) SourcedConfig[string]
func GetFirstNonEmpty ¶
func GetFirstNonEmpty[T SourcedValueT](configs ...SourcedConfig[T]) SourcedConfig[T]
GetFirstNonEmpty returns the first non-empty SourcedConfig from the provided list using the provided zero-check function
func NewFromArg ¶
func NewFromArg[T SourcedValueT](value T) SourcedConfig[T]
NewFromArg creates a SourcedConfig from a direct argument
func NewFromDefault ¶ added in v1.2.97
func NewFromDefault[T SourcedValueT](value T, desc string) SourcedConfig[T]
func NewFromEnvVar ¶
func NewFromEnvVar[T ~string](ctx context.Context, key string) SourcedConfig[T]
func NewFromFile ¶
func NewFromFile[T SourcedValueT](path string, value T) SourcedConfig[T]
NewFromFile creates a SourcedConfig from a config file
func NewFromToken ¶ added in v1.2.97
func NewFromToken[T SourcedValueT](value T, description string) SourcedConfig[T]
func (SourcedConfig[T]) WithSource ¶ added in v1.2.97
func (c SourcedConfig[T]) WithSource(source string) SourcedConfig[T]
func (SourcedConfig[T]) WithSourceF ¶ added in v1.2.97
func (c SourcedConfig[T]) WithSourceF(source string, args ...any) SourcedConfig[T]
func (SourcedConfig[T]) WithValue ¶ added in v1.2.97
func (c SourcedConfig[T]) WithValue(value T) SourcedConfig[T]
Click to show internal directories.
Click to hide internal directories.