Documentation
¶
Index ¶
- func CheckPluginVersionCompatibility(installedPluginVersion string, versionConstraint string) (bool, error)
- func ToConfigDefinitionProviders[PluginSuperType DefinitionProvider](providers map[string]PluginSuperType) map[string]DefinitionProvider
- type DefinitionProvider
- type Preparer
- type SecretKeyRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPluginVersionCompatibility ¶
func CheckPluginVersionCompatibility( installedPluginVersion string, versionConstraint string, ) (bool, error)
CheckPluginVersionCompatibility checks if the installed plugin version is compatible with the given version constraint. Version constraints are in the format of:
- `^1.2.3` for minor range constraint
- `~1.2.3` for patch range constraint
- `1.2.3` for exact version
func ToConfigDefinitionProviders ¶
func ToConfigDefinitionProviders[PluginSuperType DefinitionProvider]( providers map[string]PluginSuperType, ) map[string]DefinitionProvider
ToConfigDefinitionProviders is a helper function that converts a map of plugins (either transformers or providers) to a map of the simplified PluginConfigDefinitionProvider interface. Maps and slices of an interface aren't interchangeable between super type and subtypes.
Types ¶
type DefinitionProvider ¶
type DefinitionProvider interface {
ConfigDefinition(ctx context.Context) (*core.ConfigDefinition, error)
}
DefinitionProvider is an interface that defines any plugin type that provides a config definition schema.
type Preparer ¶
type Preparer interface {
// Prepare validates and populates default values for the provided configuration
// using the plugin-provided config definition schemas.
// It returns diagnostics for validation errors,
// and an error if something went wrong during validation and preparation.
// If validate is set to false, this will skip validation
// and only populate default values.
Prepare(
ctx context.Context,
blueprintOpConfig *types.BlueprintOperationConfig,
validate bool,
) (*types.BlueprintOperationConfig, []*core.Diagnostic, error)
}
Preparer provides an interface for a service that validates and prepares plugin-specific configuration against the plugin-provided config definition schema.
func NewDefaultPreparer ¶
func NewDefaultPreparer( providers map[string]DefinitionProvider, transformers map[string]DefinitionProvider, pluginManager pluginservicev1.Manager, secretConfigKeys secretKeyRecorder, ) Preparer
NewDefaultPreparer creates a new default implementation of a service that validates and populates defaults for plugin-specific configuration using the plugin-provided config definition schemas. The preparer is where every plugin's config definition is read, so it is also where the keys a plugin declares as secret become known.
type SecretKeyRegistry ¶ added in v0.9.0
type SecretKeyRegistry struct {
// contains filtered or unexported fields
}
SecretKeyRegistry records which plugin config keys hold secrets, so that a log entry carrying one of them under its own key can be masked.
This is purely for config key-based redaction, a value a plugin has already placed inside free text is not masked. Only the plugin knows which part of a message it composed came from a secret.
func NewSecretKeyRegistry ¶ added in v0.9.0
func NewSecretKeyRegistry() *SecretKeyRegistry
NewSecretKeyRegistry creates an empty registry, to be filled as plugin config definitions are read.
func (*SecretKeyRegistry) IsSecret ¶ added in v0.9.0
func (r *SecretKeyRegistry) IsSecret(key string) bool
IsSecret reports whether a config key was registered as holding a secret.
func (*SecretKeyRegistry) Register ¶ added in v0.9.0
func (r *SecretKeyRegistry) Register(fieldName string)
Register records a config field name as holding a secret.
A name that is a template for dynamic field names, "aws.config.regionKMSKeys.<region>", is held as a pattern, since the keys it matches are only known once a configuration supplies them.