Documentation
¶
Overview ¶
Package configedit provides reusable config mutation helpers.
This package owns pure config data transforms only. Keep command parsing, Cobra/view dependencies, keyring operations, and exit-code mapping in command packages such as configcmd.
Index ¶
- Variables
- func AddAgentSource(existing []string, raw string) ([]string, bool, error)
- func CanonicalRepositoryRoutes(routes []config.RepositoryProfile) []config.RepositoryProfile
- func FirstProfileName(profiles map[string]config.Profile) string
- func FormatRepositoryRouteSpec(spec RepositoryRouteSpec) string
- func NormalizeAgentSourcePath(raw string) (string, error)
- func NormalizeRepositoryRouteRepos(raw []string) ([]string, error)
- func NormalizeSecretsStoreID(raw string) (string, error)
- func PruneRepositoryProfileRoutes(routes []config.RepositoryProfile, profileName string) []config.RepositoryProfile
- func RemoveAgentSource(existing []string, raw string) ([]string, bool, error)
- func RemoveSecretsStore(cfg config.File, rawID string) (config.File, bool, error)
- func RenameProfile(cfg config.File, oldName string, newName string) (config.File, bool, error)
- func SetRepositoryRoutes(routes []config.RepositoryProfile, profileName string, ...) ([]config.RepositoryProfile, error)
- func SetSecretsStore(cfg config.File, rawID string, patch SecretsStorePatch) (config.File, bool, bool, error)
- func UnsetRepositoryRoutes(routes []config.RepositoryProfile, spec RepositoryRouteSpec) ([]config.RepositoryProfile, bool, error)
- func UnsetRepositoryRoutesForProfile(routes []config.RepositoryProfile, profileName string, ...) ([]config.RepositoryProfile, bool, error)
- func UpdateRepositoryProfileReferences(routes []config.RepositoryProfile, oldName string, newName string) ([]config.RepositoryProfile, bool)
- type RepositoryRouteSpec
- type SecretsStorePatch
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRouteHostRequired means a repository route host was omitted. ErrRouteHostRequired = errors.New("route host is required") // ErrRouteNamespaceRequired means a repository route namespace was omitted. ErrRouteNamespaceRequired = errors.New("route namespace is required") // ErrRouteRepoRequired means an explicitly supplied repository route repo was blank. ErrRouteRepoRequired = errors.New("route repo is required") // ErrAgentSourcePathRequired means an agent source path was omitted. ErrAgentSourcePathRequired = errors.New("agent source path is required") // ErrProfileNameRequired means a profile name was omitted. ErrProfileNameRequired = errors.New("profile name is required") // ErrProfileExists means the destination profile already exists. ErrProfileExists = errors.New("profile already exists") )
var ( // ErrSecretsStoreIDRequired means a credential-store id was omitted. ErrSecretsStoreIDRequired = errors.New("secrets-profile id is required") // ErrSecretsStoreReserved means the caller targeted a reserved projected id. ErrSecretsStoreReserved = errors.New("secrets-profile id is reserved") // ErrSecretsStoreBackendRequired means a create operation omitted the backend. ErrSecretsStoreBackendRequired = errors.New("secrets-profile backend is required") // ErrSecretsStoreMutationRequired means an update operation omitted mutation flags. ErrSecretsStoreMutationRequired = errors.New("secrets-profile mutation is required") // ErrSecretsStoreLabelConflict means both set and clear label were requested. ErrSecretsStoreLabelConflict = errors.New("secrets-profile label flags conflict") // ErrSecretsStoreLabelRequired means a provided label was blank after trim. ErrSecretsStoreLabelRequired = errors.New("secrets-profile label is required") )
Functions ¶
func AddAgentSource ¶
AddAgentSource appends raw when an equivalent normalized path is absent.
func CanonicalRepositoryRoutes ¶
func CanonicalRepositoryRoutes(routes []config.RepositoryProfile) []config.RepositoryProfile
CanonicalRepositoryRoutes returns normalized repository routes in stable order.
func FirstProfileName ¶
FirstProfileName returns the lexicographically first profile name.
func FormatRepositoryRouteSpec ¶
func FormatRepositoryRouteSpec(spec RepositoryRouteSpec) string
FormatRepositoryRouteSpec returns a stable domain representation of a route.
func NormalizeAgentSourcePath ¶
NormalizeAgentSourcePath trims and cleans an agent source path.
func NormalizeRepositoryRouteRepos ¶
NormalizeRepositoryRouteRepos trims, dedupes, and sorts repository names.
func NormalizeSecretsStoreID ¶ added in v0.10.238
NormalizeSecretsStoreID trims and validates one credential-store id.
func PruneRepositoryProfileRoutes ¶
func PruneRepositoryProfileRoutes(routes []config.RepositoryProfile, profileName string) []config.RepositoryProfile
PruneRepositoryProfileRoutes removes all repository routes pointing at profileName.
func RemoveAgentSource ¶
RemoveAgentSource removes entries that normalize to raw.
func RemoveSecretsStore ¶ added in v0.10.238
RemoveSecretsStore removes one explicit named credential store.
func RenameProfile ¶
RenameProfile renames a profile and updates route references.
func SetRepositoryRoutes ¶
func SetRepositoryRoutes(routes []config.RepositoryProfile, profileName string, spec RepositoryRouteSpec) ([]config.RepositoryProfile, error)
SetRepositoryRoutes assigns the specified routes to profileName.
func SetSecretsStore ¶ added in v0.10.238
func SetSecretsStore(cfg config.File, rawID string, patch SecretsStorePatch) (config.File, bool, bool, error)
SetSecretsStore creates or updates one named credential store.
func UnsetRepositoryRoutes ¶
func UnsetRepositoryRoutes(routes []config.RepositoryProfile, spec RepositoryRouteSpec) ([]config.RepositoryProfile, bool, error)
UnsetRepositoryRoutes removes the specified routes.
func UnsetRepositoryRoutesForProfile ¶ added in v0.9.192
func UnsetRepositoryRoutesForProfile(routes []config.RepositoryProfile, profileName string, spec RepositoryRouteSpec) ([]config.RepositoryProfile, bool, error)
UnsetRepositoryRoutesForProfile removes the specified routes only for profileName.
func UpdateRepositoryProfileReferences ¶
func UpdateRepositoryProfileReferences(routes []config.RepositoryProfile, oldName string, newName string) ([]config.RepositoryProfile, bool)
UpdateRepositoryProfileReferences renames route profile references.
Types ¶
type RepositoryRouteSpec ¶
RepositoryRouteSpec identifies one namespace route or one set of repo routes.
func NormalizeRepositoryRouteSpec ¶
func NormalizeRepositoryRouteSpec(spec RepositoryRouteSpec) (RepositoryRouteSpec, error)
NormalizeRepositoryRouteSpec returns a normalized copy of spec.
type SecretsStorePatch ¶ added in v0.10.238
type SecretsStorePatch struct {
Backend *config.SecretsStoreBackend
Label *string
ClearLabel bool
}
SecretsStorePatch describes a config-only update to one named credential store.