{"modulePath":"github.com/newstack-cloud/bluelink/apps/deploy-engine","version":"v0.9.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package pluginconfig\n\n## Functions\n\n```go\nfunc CheckPluginVersionCompatibility(\n\tinstalledPluginVersion string,\n\tversionConstraint string,\n) (bool, error)\n```\nCheckPluginVersionCompatibility checks if the installed plugin version is compatible with the given version constraint. Version constraints are in the format of:\n\n  - \\`^1.2.3\\` for minor range constraint\n  - \\`~1.2.3\\` for patch range constraint\n  - \\`1.2.3\\` for exact version\n\n```go\nfunc ToConfigDefinitionProviders[PluginSuperType DefinitionProvider](\n\tproviders map[string]PluginSuperType,\n) map[string]DefinitionProvider\n```\nToConfigDefinitionProviders 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.\n\n## Types\n\n```go\ntype DefinitionProvider interface {\n\tConfigDefinition(ctx context.Context) (*core.ConfigDefinition, error)\n}\n```\nDefinitionProvider is an interface that defines any plugin type that provides a config definition schema.\n\n```go\ntype Preparer interface {\n\t// Prepare validates and populates default values for the provided configuration\n\t// using the plugin-provided config definition schemas.\n\t// It returns diagnostics for validation errors,\n\t// and an error if something went wrong during validation and preparation.\n\t// If validate is set to false, this will skip validation\n\t// and only populate default values.\n\tPrepare(\n\t\tctx context.Context,\n\t\tblueprintOpConfig *types.BlueprintOperationConfig,\n\t\tvalidate bool,\n\t) (*types.BlueprintOperationConfig, []*core.Diagnostic, error)\n}\n```\nPreparer provides an interface for a service that validates and prepares plugin-specific configuration against the plugin-provided config definition schema.\n\n```go\nfunc NewDefaultPreparer(\n\tproviders map[string]DefinitionProvider,\n\ttransformers map[string]DefinitionProvider,\n\tpluginManager pluginservicev1.Manager,\n\tsecretConfigKeys secretKeyRecorder,\n) Preparer\n```\nNewDefaultPreparer 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.\n\n```go\ntype SecretKeyRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nSecretKeyRegistry records which plugin config keys hold secrets, so that a log entry carrying one of them under its own key can be masked.\n\nThis 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.\n\n```go\nfunc NewSecretKeyRegistry() *SecretKeyRegistry\n```\nNewSecretKeyRegistry creates an empty registry, to be filled as plugin config definitions are read.\n\n```go\nfunc (r *SecretKeyRegistry) IsSecret(key string) bool\n```\nIsSecret reports whether a config key was registered as holding a secret.\n\n```go\nfunc (r *SecretKeyRegistry) Register(fieldName string)\n```\nRegister records a config field name as holding a secret.\n\nA name that is a template for dynamic field names, \"aws.config.regionKMSKeys.\\\u003cregion\u003e\", is held as a pattern, since the keys it matches are only known once a configuration supplies them.\n\n","path":"github.com/newstack-cloud/bluelink/apps/deploy-engine/internal/pluginconfig","name":"pluginconfig","synopsis":"","isRedistributable":true}
