Documentation
¶
Index ¶
- Variables
- func FetchURL(ctx context.Context, rawURL string) ([]byte, error)
- func FetchURLWithOptions(ctx context.Context, rawURL string, options URLFetchOptions) ([]byte, error)
- func ResolveReferences(ctx context.Context, rs *resources.ResourceSet) error
- func ValidateYAMLFile(path string) bool
- type FieldResolver
- type Loader
- func (l *Loader) Load() (*resources.ResourceSet, error)
- func (l *Loader) LoadFile(path string) (*resources.ResourceSet, error)
- func (l *Loader) LoadFromSources(sources []Source, recursive bool) (*resources.ResourceSet, error)
- func (l *Loader) LoadFromSourcesWithContext(ctx context.Context, sources []Source, recursive bool) (*resources.ResourceSet, error)
- func (l *Loader) WithURLFetchOptions(options URLFetchOptions) *Loader
- type LocalFieldResolver
- type Source
- type SourceType
- type URLFetchAuthPolicy
- type URLFetchOptions
- type URLFetchTokenSource
Constants ¶
This section is empty.
Variables ¶
var ErrNoSources = errors.New("no configuration sources specified; use -f to specify files, directories, or URLs")
ErrNoSources is returned when no configuration sources are provided.
Functions ¶
func FetchURL ¶ added in v1.3.0
FetchURL retrieves a declarative configuration source from an HTTP(S) URL.
func FetchURLWithOptions ¶ added in v1.3.0
func FetchURLWithOptions(ctx context.Context, rawURL string, options URLFetchOptions) ([]byte, error)
FetchURLWithOptions retrieves a declarative configuration source from an HTTP(S) URL using the provided options.
func ResolveReferences ¶ added in v0.1.5
func ResolveReferences(ctx context.Context, rs *resources.ResourceSet) error
ResolveReferences resolves all ref placeholders in the ResourceSet
func ValidateYAMLFile ¶
ValidateYAMLFile checks if a file has a valid YAML extension
Types ¶
type FieldResolver ¶ added in v0.1.5
type FieldResolver interface {
// ResolveField extracts a field value from a resource
ResolveField(resource resources.Resource, field string) (string, error)
// CanResolve checks if this resolver can handle the given resource type
CanResolve(resourceType string) bool
}
FieldResolver interface for field resolution
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles loading declarative configuration from files
func NewWithBaseDir ¶ added in v0.3.6
NewWithBaseDir creates a new configuration loader with a base directory for !file boundaries
func NewWithPath ¶
NewWithPath creates a new configuration loader with a root path (deprecated, for backward compatibility)
func (*Loader) Load ¶
func (l *Loader) Load() (*resources.ResourceSet, error)
Load loads configuration from the default current directory (deprecated)
func (*Loader) LoadFile ¶
func (l *Loader) LoadFile(path string) (*resources.ResourceSet, error)
LoadFile loads configuration from a single YAML file (deprecated, for backward compatibility)
func (*Loader) LoadFromSources ¶
LoadFromSources loads configuration from multiple sources
func (*Loader) LoadFromSourcesWithContext ¶ added in v0.1.5
func (l *Loader) LoadFromSourcesWithContext(ctx context.Context, sources []Source, recursive bool, ) (*resources.ResourceSet, error)
LoadFromSourcesWithContext loads configuration from multiple sources with context support
func (*Loader) WithURLFetchOptions ¶ added in v1.3.0
func (l *Loader) WithURLFetchOptions(options URLFetchOptions) *Loader
WithURLFetchOptions configures remote URL source fetching.
type LocalFieldResolver ¶ added in v0.1.5
type LocalFieldResolver struct {
// contains filtered or unexported fields
}
LocalFieldResolver resolves fields from local ResourceSet
func NewLocalFieldResolver ¶ added in v0.1.5
func NewLocalFieldResolver(logger *slog.Logger) *LocalFieldResolver
NewLocalFieldResolver creates a new local field resolver
func (*LocalFieldResolver) CanResolve ¶ added in v0.1.5
func (r *LocalFieldResolver) CanResolve(_ string) bool
CanResolve checks if this resolver can handle the resource type
func (*LocalFieldResolver) ResolveField ¶ added in v0.1.5
func (r *LocalFieldResolver) ResolveField(resource resources.Resource, field string) (string, error)
ResolveField extracts field value using reflection
type Source ¶
type Source struct {
Path string
Type SourceType
}
Source represents a configuration source with its type
func ParseSources ¶
ParseSources parses the filename flag values into individual sources
type SourceType ¶
type SourceType int
SourceType represents the type of configuration source
const ( // SourceTypeFile represents a single file source SourceTypeFile SourceType = iota // SourceTypeDirectory represents a directory source SourceTypeDirectory // SourceTypeSTDIN represents stdin source SourceTypeSTDIN // SourceTypeURL represents an HTTP(S) URL source SourceTypeURL )
type URLFetchAuthPolicy ¶ added in v1.3.0
type URLFetchAuthPolicy string
URLFetchAuthPolicy controls when remote declarative URL fetches may include authentication.
const ( // URLFetchAuthAuto sends the configured bearer token only to HTTPS URLs whose host is explicitly allowed. URLFetchAuthAuto URLFetchAuthPolicy = "auto" // URLFetchAuthNone disables authentication for remote declarative URL fetches. URLFetchAuthNone URLFetchAuthPolicy = "none" )
type URLFetchOptions ¶ added in v1.3.0
type URLFetchOptions struct {
AuthPolicy URLFetchAuthPolicy
AuthAllowedHosts []string
TokenSource URLFetchTokenSource
}
URLFetchOptions controls remote declarative URL fetch behavior that should be selected by the command layer.
func (URLFetchOptions) AllowsAuthenticationForURL ¶ added in v1.3.0
func (o URLFetchOptions) AllowsAuthenticationForURL(rawURL string) bool
AllowsAuthenticationForURL reports whether the URL is within the configured authentication boundary.