Documentation
¶
Index ¶
- type Registry
- func (r *Registry) CheckAccessibility(ctx context.Context, refs []core.SecretRef) error
- func (r *Registry) Get(provider string) Resolver
- func (r *Registry) Providers() []string
- func (r *Registry) Register(name string, res Resolver)
- func (r *Registry) Resolve(ctx context.Context, ref core.SecretRef) (string, error)
- func (r *Registry) ResolveAll(ctx context.Context, refs []core.SecretRef) ([]string, error)
- type Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages all secret resolvers. It is thread-safe and can be used concurrently.
func NewRegistry ¶
NewRegistry creates a new registry with all registered providers. baseDirs is used by the file provider to resolve relative paths. The file provider tries each base directory in order until a file is found.
func (*Registry) CheckAccessibility ¶
CheckAccessibility validates that all secrets are accessible without fetching values. Used during dry-run and validate modes. Returns an error if any secret is inaccessible.
func (*Registry) Get ¶
Get retrieves a resolver by provider name. Returns nil if the provider is not registered.
func (*Registry) Register ¶
Register adds a custom resolver to the registry. If a resolver with the same name already exists, it will be replaced. This is useful for adding custom providers or testing.
type Resolver ¶
type Resolver interface {
// Name returns the provider identifier (e.g., "env", "file", "gcp-secrets").
Name() string
// Resolve fetches the secret value for the given reference.
// Returns an error if the secret cannot be retrieved.
Resolve(ctx context.Context, ref core.SecretRef) (string, error)
// Validate checks if the secret reference is structurally valid for this provider.
// This is called at parse time and should not make network calls.
Validate(ref core.SecretRef) error
// CheckAccessibility verifies the secret is accessible without fetching its value.
// Used during dry-run and validate modes.
// Should verify:
// - Provider is reachable
// - Credentials are valid
// - Secret exists
// - Caller has permission
CheckAccessibility(ctx context.Context, ref core.SecretRef) error
}
Resolver fetches secret values from a specific backend. Implementations must be thread-safe as they may be called concurrently.