Documentation
¶
Index ¶
- Constants
- Variables
- func AddCreateFlags(cmd *cobra.Command, options ...CreateOption)
- func AddDrupalRootfsFlag(cmd *cobra.Command, target *string, defaultValue string)
- func AddReportFlags(cmd *cobra.Command, verboseTarget *bool, formatTarget *string)
- func AddReviewFlags(cmd *cobra.Command, reportTarget, verboseTarget *bool, formatTarget *string)
- func BuildReviewQuestion(view ReviewView) string
- func DriftCheckLines(view ReviewView) []string
- func MarkCodebaseRootfsFlag(cmd *cobra.Command, flagName string)
- func ParseStateOverrides(values map[string]string) (map[string]State, error)
- func PromptChoice(name string, choices []Choice, defaultValue string, input InputFunc, ...) (string, error)
- func PromptCreateFollowUps(cmd *cobra.Command, option CreateOption, decision *ReviewDecision, ...) error
- func PromptDeclaredReviewFollowUps(view ReviewView, decision *ReviewDecision, input InputFunc, ...) error
- func PromptFollowUp(componentName string, spec FollowUpSpec, defaultValue string, input InputFunc, ...) (string, error)
- func RenderChecklistItem(label, state, detail string) string
- func RenderCommandBlock(text string) string
- func RenderComponentStatus(view ReviewView) string
- func RenderConfiguredFollowUps(view ReviewView) []string
- func RenderCurrentGuidance(view ReviewView) string
- func RenderDecisionFollowUps(def Definition, decision ReviewDecision) string
- func RenderFollowUpSection(componentName string, spec FollowUpSpec) string
- func RenderIntroSection(title, body string) string
- func RenderMigrationImpact(migration DataMigrationRequirement) string
- func RenderPromptLine(text string) string
- func RenderReviewSummary(views []ReviewView, decisions map[string]ReviewDecision, ...) (string, error)
- func RenderSection(title, body string) string
- func RenderTransitionSummary(behavior TransitionBehavior) string
- func ResolveCreateDecisions(cmd *cobra.Command, input InputFunc, options ...CreateOption) (map[string]ReviewDecision, error)
- func ResolveCreateStates(cmd *cobra.Command, input InputFunc, options ...CreateOption) (map[string]State, error)
- func RunReview(views []ReviewView, opts ReviewOptions) (map[string]ReviewDecision, error)
- func WriteComponentCatalog(out io.Writer, pluginName string, defs []Definition, componentName string) error
- func WriteComponentStatusReport(out io.Writer, views []ReviewView, verbose bool) error
- func WriteComponentStatusReportWithFormat(out io.Writer, views []ReviewView, verbose bool, format string) error
- func WriteDriftDetails(out io.Writer, status ComponentStatus)
- type ApplyOptions
- type Behavior
- type Choice
- type Component
- type ComponentSpec
- type ComponentStatus
- type ComposeDefinitions
- type ComposeFile
- func (c *ComposeFile) AddSectionEntryBlock(section, key, block string) error
- func (c *ComposeFile) AddServiceBlock(name, block string) error
- func (c *ComposeFile) AddVolumeBlock(name, block string) error
- func (c *ComposeFile) DeleteSectionEntry(section, key string) error
- func (c *ComposeFile) DeleteService(name string) error
- func (c *ComposeFile) DeleteServiceEnv(service, key string) error
- func (c *ComposeFile) DeleteServiceKey(service, key string) error
- func (c *ComposeFile) DeleteVolume(name string) error
- func (c *ComposeFile) HasService(name string) bool
- func (c *ComposeFile) HasVolume(name string) bool
- func (c *ComposeFile) Save() error
- func (c *ComposeFile) SectionEntryBlock(section, key string) (string, bool)
- func (c *ComposeFile) ServiceBlock(name string) (string, bool)
- func (c *ComposeFile) SetServiceEnv(service, key, value string) error
- func (c *ComposeFile) SetServiceStringList(service, key string, values []string) error
- func (c *ComposeFile) VolumeBlock(name string) (string, bool)
- type ComposeProject
- func (c *ComposeProject) AddDefinitions(defs *ComposeDefinitions)
- func (c *ComposeProject) ApplyRules(rules []YAMLRule) error
- func (c *ComposeProject) Bytes() ([]byte, error)
- func (c *ComposeProject) DeleteDefinition(section, name string) bool
- func (c *ComposeProject) PruneUnusedResources()
- func (c *ComposeProject) RemoveService(name string) bool
- func (c *ComposeProject) SetDefinition(section, name string, value any)
- type ComposeServiceComponent
- func (c ComposeServiceComponent) DefaultState() State
- func (c ComposeServiceComponent) Definition() Definition
- func (c ComposeServiceComponent) Name() string
- func (c ComposeServiceComponent) SpecFor(state State) ComponentSpec
- func (c ComposeServiceComponent) SpecForWithOptions(state State, options map[string]string) ComponentSpec
- type ComposeServiceComponentOptions
- type ComposeSpec
- type CreateOption
- type DataMigrationRequirement
- type Definition
- func (d Definition) ComposerPackagesForEnable() []string
- func (d Definition) CreateOption() CreateOption
- func (d Definition) DrupalModulesForEnable() []DrupalModuleDependency
- func (d Definition) FollowUpsForDisposition(disposition Disposition) []FollowUpSpec
- func (d Definition) FollowUpsForState(state State) []FollowUpSpec
- func (d Definition) StrictComposerPackages() []string
- func (d Definition) StrictDrupalModules() []DrupalModuleDependency
- type DeleteMapEntriesTransform
- type Dependencies
- type DetectOptions
- type DetectedState
- type Disposition
- func LegacyDispositionForState(allowed []Disposition, state State) Disposition
- func ParseDisposition(value string) (Disposition, error)
- func PromptDisposition(name string, guidance StateGuidance, allowed []Disposition, ...) (Disposition, error)
- func ResolveAllowedDisposition(allowed []Disposition, disposition Disposition) (Disposition, error)
- func ReviewDefaultDisposition(view ReviewView) Disposition
- func StateToDisposition(state State) Disposition
- type DomainSpec
- type DrupalConfigSet
- func (d *DrupalConfigSet) DeleteFiles(names ...string)
- func (d *DrupalConfigSet) DeleteMapEntries(match MapEntryMatch) error
- func (d *DrupalConfigSet) ReplaceString(old, new string)
- func (d *DrupalConfigSet) Save(ctx *config.Context) error
- func (d *DrupalConfigSet) UpsertFile(name string, data []byte)
- type DrupalLayout
- type DrupalModuleDependency
- type DrupalModuleDependencyMode
- type DrupalSpec
- type DrupalTransform
- type FileRule
- type FileStateSpec
- type FollowUpSpec
- type FollowUpValue
- type GateSpec
- type Hook
- type InputFunc
- type Manager
- func (m *Manager) DisableComponent(ctx context.Context, spec ComponentSpec) error
- func (m *Manager) DisableComponentWithOptions(ctx context.Context, spec ComponentSpec, opts ApplyOptions) error
- func (m *Manager) EnableComponent(ctx context.Context, spec ComponentSpec) error
- func (m *Manager) EnableComponentWithOptions(ctx context.Context, spec ComponentSpec, opts ApplyOptions) error
- func (m *Manager) ReconcileAll(ctx context.Context, states map[string]State, opts ApplyOptions, ...) error
- func (m *Manager) ReconcileComponent(ctx context.Context, feature Component, state State, opts ApplyOptions) error
- type MapEntryMatch
- type PromptChoiceFunc
- type PromptDispositionFunc
- type PromptStateFunc
- type Registry
- type ReplaceStringsTransform
- type RepoSource
- type ReportRow
- type ReviewConfirmFunc
- type ReviewDecision
- type ReviewMode
- type ReviewOptions
- type ReviewPromptExtraFunc
- type ReviewView
- type RuleCheckResult
- type RuleOp
- type Runtime
- type State
- type StateCheck
- type StateGuidance
- type StaticComponent
- type StringReplacement
- type SummaryLineFunc
- type TransitionBehavior
- type YAMLDocument
- func (d *YAMLDocument) AppendUniqueString(path, value string) error
- func (d *YAMLDocument) Bytes() ([]byte, error)
- func (d *YAMLDocument) DeletePath(path string) error
- func (d *YAMLDocument) HasPath(path string) (bool, error)
- func (d *YAMLDocument) RemoveMatchingString(path string, match func(string) bool) (bool, error)
- func (d *YAMLDocument) RemoveString(path, value string) error
- func (d *YAMLDocument) SetString(path, value string) error
- func (d *YAMLDocument) SetValue(path string, value any) error
- type YAMLRule
- type YAMLStateSpec
Constants ¶
const ( ReportFormatSection = "section" ReportFormatTable = "table" ReportFormatJSON = "json" ReportFormatYAML = "yaml" )
const CodebaseRootfsFlagAnnotation = "sitectl.libops.dev/codebase-rootfs-flag"
CodebaseRootfsFlagAnnotation marks a command flag as the CLI flag that receives the generic codebase_rootfs RPC parameter.
const DefaultDrupalRootfs = "."
Variables ¶
var ErrActionCancelled = errors.New("component action cancelled")
Functions ¶
func AddCreateFlags ¶
func AddCreateFlags(cmd *cobra.Command, options ...CreateOption)
func AddDrupalRootfsFlag ¶
AddDrupalRootfsFlag adds the standard Drupal rootfs flag to cmd.
func AddReportFlags ¶ added in v0.7.0
func AddReviewFlags ¶ added in v0.7.0
func BuildReviewQuestion ¶ added in v0.7.0
func BuildReviewQuestion(view ReviewView) string
func DriftCheckLines ¶ added in v0.7.0
func DriftCheckLines(view ReviewView) []string
func MarkCodebaseRootfsFlag ¶ added in v0.18.0
MarkCodebaseRootfsFlag marks flagName as the command's codebase rootfs flag for RPC argv reconstruction.
func ParseStateOverrides ¶
func PromptChoice ¶ added in v0.6.1
func PromptCreateFollowUps ¶ added in v0.8.0
func PromptCreateFollowUps(cmd *cobra.Command, option CreateOption, decision *ReviewDecision, input InputFunc) error
func PromptDeclaredReviewFollowUps ¶ added in v0.8.0
func PromptDeclaredReviewFollowUps(view ReviewView, decision *ReviewDecision, input InputFunc, promptChoice PromptChoiceFunc) error
func PromptFollowUp ¶ added in v0.8.0
func PromptFollowUp(componentName string, spec FollowUpSpec, defaultValue string, input InputFunc, promptChoice PromptChoiceFunc) (string, error)
func RenderChecklistItem ¶ added in v0.6.0
func RenderCommandBlock ¶ added in v0.6.0
func RenderComponentStatus ¶ added in v0.7.0
func RenderComponentStatus(view ReviewView) string
func RenderConfiguredFollowUps ¶ added in v0.8.0
func RenderConfiguredFollowUps(view ReviewView) []string
func RenderCurrentGuidance ¶ added in v0.7.0
func RenderCurrentGuidance(view ReviewView) string
func RenderDecisionFollowUps ¶ added in v0.8.0
func RenderDecisionFollowUps(def Definition, decision ReviewDecision) string
func RenderFollowUpSection ¶ added in v0.8.0
func RenderFollowUpSection(componentName string, spec FollowUpSpec) string
func RenderIntroSection ¶ added in v0.5.4
func RenderMigrationImpact ¶ added in v0.7.0
func RenderMigrationImpact(migration DataMigrationRequirement) string
func RenderPromptLine ¶ added in v0.5.4
func RenderReviewSummary ¶ added in v0.7.0
func RenderReviewSummary(views []ReviewView, decisions map[string]ReviewDecision, summaryLine SummaryLineFunc) (string, error)
func RenderSection ¶ added in v0.5.4
func RenderTransitionSummary ¶ added in v0.7.0
func RenderTransitionSummary(behavior TransitionBehavior) string
func ResolveCreateDecisions ¶ added in v0.8.0
func ResolveCreateDecisions(cmd *cobra.Command, input InputFunc, options ...CreateOption) (map[string]ReviewDecision, error)
func ResolveCreateStates ¶
func RunReview ¶ added in v0.7.0
func RunReview(views []ReviewView, opts ReviewOptions) (map[string]ReviewDecision, error)
func WriteComponentCatalog ¶ added in v0.17.2
func WriteComponentCatalog(out io.Writer, pluginName string, defs []Definition, componentName string) error
WriteComponentCatalog renders component names, dispositions, and set-time flag guidance for a plugin component registry.
func WriteComponentStatusReport ¶ added in v0.7.0
func WriteComponentStatusReport(out io.Writer, views []ReviewView, verbose bool) error
func WriteComponentStatusReportWithFormat ¶ added in v0.7.0
func WriteDriftDetails ¶ added in v0.7.0
func WriteDriftDetails(out io.Writer, status ComponentStatus)
Types ¶
type ApplyOptions ¶
type Behavior ¶
type Behavior struct {
Idempotent bool `json:"idempotent,omitempty" yaml:"idempotent,omitempty"`
Enable TransitionBehavior `json:"enable,omitempty" yaml:"enable,omitempty"`
Disable TransitionBehavior `json:"disable,omitempty" yaml:"disable,omitempty"`
}
type Choice ¶ added in v0.6.1
type Choice struct {
Value string `json:"value" yaml:"value"`
Label string `json:"label,omitempty" yaml:"label,omitempty"`
Help string `json:"help,omitempty" yaml:"help,omitempty"`
Aliases []string `json:"aliases,omitempty" yaml:"aliases,omitempty"`
AllowCustomInput bool `json:"allow_custom_input,omitempty" yaml:"allow_custom_input,omitempty"`
}
type Component ¶
type Component interface {
Name() string
DefaultState() State
SpecFor(state State) ComponentSpec
}
type ComponentSpec ¶
type ComponentSpec struct {
Name string
Gates GateSpec
Compose ComposeSpec
Drupal DrupalSpec
Files FileStateSpec
BeforeDisable []Hook
AfterDisable []Hook
BeforeEnable []Hook
AfterEnable []Hook
}
type ComponentStatus ¶
type ComponentStatus struct {
Name string
State DetectedState
On StateCheck
Off StateCheck
}
func DetectComponentStatus ¶
func DetectComponentStatus(ctx *config.Context, projectRoot string, def Definition, opts DetectOptions) (ComponentStatus, error)
func DetectComponentStatuses ¶
func DetectComponentStatuses(ctx *config.Context, projectRoot string, opts DetectOptions, defs ...Definition) ([]ComponentStatus, error)
type ComposeDefinitions ¶
type ComposeDefinitions struct {
Services map[string]any `json:"services,omitempty" yaml:"services,omitempty"`
Networks map[string]any `json:"networks,omitempty" yaml:"networks,omitempty"`
Volumes map[string]any `json:"volumes,omitempty" yaml:"volumes,omitempty"`
Secrets map[string]any `json:"secrets,omitempty" yaml:"secrets,omitempty"`
Configs map[string]any `json:"configs,omitempty" yaml:"configs,omitempty"`
}
ComposeDefinitions contains reusable Docker Compose sections owned by a service component.
func ParseComposeDefinitions ¶
func ParseComposeDefinitions(data []byte) (*ComposeDefinitions, error)
ParseComposeDefinitions parses service component compose definitions.
func (*ComposeDefinitions) Definition ¶ added in v0.10.0
func (d *ComposeDefinitions) Definition(section, name string) (any, bool)
Definition returns one compose definition by section and name.
type ComposeFile ¶
type ComposeFile struct {
// contains filtered or unexported fields
}
func LoadComposeFile ¶
func LoadComposeFile(path string) (*ComposeFile, error)
func LoadComposeFileOptional ¶ added in v0.9.2
func LoadComposeFileOptional(path string) (*ComposeFile, error)
func (*ComposeFile) AddSectionEntryBlock ¶ added in v0.10.0
func (c *ComposeFile) AddSectionEntryBlock(section, key, block string) error
func (*ComposeFile) AddServiceBlock ¶ added in v0.9.2
func (c *ComposeFile) AddServiceBlock(name, block string) error
func (*ComposeFile) AddVolumeBlock ¶ added in v0.9.3
func (c *ComposeFile) AddVolumeBlock(name, block string) error
func (*ComposeFile) DeleteSectionEntry ¶ added in v0.5.1
func (c *ComposeFile) DeleteSectionEntry(section, key string) error
func (*ComposeFile) DeleteService ¶ added in v0.5.1
func (c *ComposeFile) DeleteService(name string) error
func (*ComposeFile) DeleteServiceEnv ¶ added in v0.5.1
func (c *ComposeFile) DeleteServiceEnv(service, key string) error
func (*ComposeFile) DeleteServiceKey ¶ added in v0.9.2
func (c *ComposeFile) DeleteServiceKey(service, key string) error
func (*ComposeFile) DeleteVolume ¶ added in v0.5.1
func (c *ComposeFile) DeleteVolume(name string) error
func (*ComposeFile) HasService ¶ added in v0.9.2
func (c *ComposeFile) HasService(name string) bool
func (*ComposeFile) HasVolume ¶ added in v0.9.3
func (c *ComposeFile) HasVolume(name string) bool
func (*ComposeFile) Save ¶ added in v0.5.1
func (c *ComposeFile) Save() error
func (*ComposeFile) SectionEntryBlock ¶ added in v0.10.0
func (c *ComposeFile) SectionEntryBlock(section, key string) (string, bool)
func (*ComposeFile) ServiceBlock ¶ added in v0.9.2
func (c *ComposeFile) ServiceBlock(name string) (string, bool)
func (*ComposeFile) SetServiceEnv ¶ added in v0.5.1
func (c *ComposeFile) SetServiceEnv(service, key, value string) error
func (*ComposeFile) SetServiceStringList ¶ added in v0.9.2
func (c *ComposeFile) SetServiceStringList(service, key string, values []string) error
func (*ComposeFile) VolumeBlock ¶ added in v0.9.3
func (c *ComposeFile) VolumeBlock(name string) (string, bool)
type ComposeProject ¶ added in v0.5.1
type ComposeProject struct {
// contains filtered or unexported fields
}
ComposeProject is an editable Docker Compose document.
func ParseComposeProject ¶ added in v0.5.1
func ParseComposeProject(data []byte) (*ComposeProject, error)
ParseComposeProject parses a full Docker Compose document.
func (*ComposeProject) AddDefinitions ¶ added in v0.5.1
func (c *ComposeProject) AddDefinitions(defs *ComposeDefinitions)
AddDefinitions merges service component definitions into the project.
func (*ComposeProject) ApplyRules ¶ added in v0.18.0
func (c *ComposeProject) ApplyRules(rules []YAMLRule) error
ApplyRules applies YAML rules against the compose project.
func (*ComposeProject) Bytes ¶ added in v0.5.1
func (c *ComposeProject) Bytes() ([]byte, error)
Bytes marshals the compose project back to YAML.
func (*ComposeProject) DeleteDefinition ¶ added in v0.10.0
func (c *ComposeProject) DeleteDefinition(section, name string) bool
DeleteDefinition removes one top-level compose section entry.
func (*ComposeProject) PruneUnusedResources ¶ added in v0.5.1
func (c *ComposeProject) PruneUnusedResources()
PruneUnusedResources removes unused volumes, networks, secrets, and configs.
func (*ComposeProject) RemoveService ¶ added in v0.5.1
func (c *ComposeProject) RemoveService(name string) bool
RemoveService removes a service and any references to it from depends_on.
func (*ComposeProject) SetDefinition ¶ added in v0.10.0
func (c *ComposeProject) SetDefinition(section, name string, value any)
SetDefinition sets one top-level compose section entry.
type ComposeServiceComponent ¶ added in v0.18.0
type ComposeServiceComponent struct {
// contains filtered or unexported fields
}
ComposeServiceComponent is a component implementation that applies or removes Docker Compose service definitions.
func NewComposeServiceComponent ¶ added in v0.18.0
func NewComposeServiceComponent(opts ComposeServiceComponentOptions) (ComposeServiceComponent, error)
NewComposeServiceComponent builds a service component from compose definitions and component metadata.
func (ComposeServiceComponent) DefaultState ¶ added in v0.18.0
func (c ComposeServiceComponent) DefaultState() State
DefaultState returns the component state reconciled by default.
func (ComposeServiceComponent) Definition ¶ added in v0.18.0
func (c ComposeServiceComponent) Definition() Definition
Definition returns the user-facing component definition.
func (ComposeServiceComponent) Name ¶ added in v0.18.0
func (c ComposeServiceComponent) Name() string
Name returns the component name.
func (ComposeServiceComponent) SpecFor ¶ added in v0.18.0
func (c ComposeServiceComponent) SpecFor(state State) ComponentSpec
SpecFor returns the compose apply spec for the requested state.
func (ComposeServiceComponent) SpecForWithOptions ¶ added in v0.18.0
func (c ComposeServiceComponent) SpecForWithOptions(state State, options map[string]string) ComponentSpec
SpecForWithOptions returns the compose apply spec for the requested state after applying option-derived follow-up rules.
type ComposeServiceComponentOptions ¶ added in v0.18.0
type ComposeServiceComponentOptions struct {
Name string
Description string
ComposeYAML []byte
Definitions *ComposeDefinitions
ServiceNames []string
AppService string
AppDependencies map[string]any
AppEnvironment map[string]string
DefaultState State
DefaultDisposition Disposition
AllowedDispositions []Disposition
Dependencies Dependencies
Guidance StateGuidance
PromptOnCreate bool
FollowUps []FollowUpSpec
Gates GateSpec
Behavior Behavior
ExtraOnRules []YAMLRule
ExtraOffRules []YAMLRule
FileOnRules []FileRule
FileOffRules []FileRule
ApplyFollowUps func(map[string]string) []YAMLRule
}
ComposeServiceComponentOptions describes a service component backed by Docker Compose definitions and optional target application wiring.
type ComposeSpec ¶
type ComposeSpec struct {
Definitions *ComposeDefinitions `json:"definitions,omitempty" yaml:"definitions,omitempty"`
RemoveServices []string `json:"remove_services,omitempty" yaml:"remove_services,omitempty"`
PruneUnusedResource bool `json:"prune_unused_resource,omitempty" yaml:"prune_unused_resource,omitempty"`
Rules []YAMLRule `json:"rules,omitempty" yaml:"rules,omitempty"`
}
type CreateOption ¶
type CreateOption struct {
Name string `json:"name" yaml:"name"`
Default State `json:"default,omitempty" yaml:"default,omitempty"`
DefaultDisposition Disposition `json:"default_disposition,omitempty" yaml:"default_disposition,omitempty"`
AllowedDispositions []Disposition `json:"allowed_dispositions,omitempty" yaml:"allowed_dispositions,omitempty"`
Guidance StateGuidance `json:"guidance,omitempty" yaml:"guidance,omitempty"`
Shorthand string `json:"shorthand,omitempty" yaml:"shorthand,omitempty"`
PromptOnCreate bool `json:"prompt_on_create,omitempty" yaml:"prompt_on_create,omitempty"`
FollowUps []FollowUpSpec `json:"follow_ups,omitempty" yaml:"follow_ups,omitempty"`
}
type DataMigrationRequirement ¶
type DataMigrationRequirement string
const ( DataMigrationNone DataMigrationRequirement = "none" DataMigrationBackfill DataMigrationRequirement = "backfill" DataMigrationHard DataMigrationRequirement = "hard" )
type Definition ¶
type Definition struct {
Name string `json:"name" yaml:"name"`
DefaultState State `json:"default_state,omitempty" yaml:"default_state,omitempty"`
DefaultDisposition Disposition `json:"default_disposition,omitempty" yaml:"default_disposition,omitempty"`
AllowedDispositions []Disposition `json:"allowed_dispositions,omitempty" yaml:"allowed_dispositions,omitempty"`
Guidance StateGuidance `json:"guidance,omitempty" yaml:"guidance,omitempty"`
PromptOnCreate bool `json:"prompt_on_create,omitempty" yaml:"prompt_on_create,omitempty"`
FollowUps []FollowUpSpec `json:"follow_ups,omitempty" yaml:"follow_ups,omitempty"`
Gates GateSpec `json:"gates,omitempty" yaml:"gates,omitempty"`
Dependencies Dependencies `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
Behavior Behavior `json:"behavior,omitempty" yaml:"behavior,omitempty"`
On DomainSpec `json:"on,omitempty" yaml:"on,omitempty"`
Off DomainSpec `json:"off,omitempty" yaml:"off,omitempty"`
}
func (Definition) ComposerPackagesForEnable ¶
func (d Definition) ComposerPackagesForEnable() []string
func (Definition) CreateOption ¶ added in v0.5.2
func (d Definition) CreateOption() CreateOption
func (Definition) DrupalModulesForEnable ¶
func (d Definition) DrupalModulesForEnable() []DrupalModuleDependency
func (Definition) FollowUpsForDisposition ¶ added in v0.9.0
func (d Definition) FollowUpsForDisposition(disposition Disposition) []FollowUpSpec
func (Definition) FollowUpsForState ¶ added in v0.8.0
func (d Definition) FollowUpsForState(state State) []FollowUpSpec
func (Definition) StrictComposerPackages ¶
func (d Definition) StrictComposerPackages() []string
func (Definition) StrictDrupalModules ¶
func (d Definition) StrictDrupalModules() []DrupalModuleDependency
type DeleteMapEntriesTransform ¶
type DeleteMapEntriesTransform struct {
Matches []MapEntryMatch
}
func (DeleteMapEntriesTransform) Apply ¶
func (t DeleteMapEntriesTransform) Apply(set *DrupalConfigSet) error
type Dependencies ¶
type Dependencies struct {
DrupalModules []DrupalModuleDependency `json:"drupal_modules,omitempty" yaml:"drupal_modules,omitempty"`
}
func (Dependencies) ComposerPackagesForEnable ¶
func (d Dependencies) ComposerPackagesForEnable() []string
func (Dependencies) DrupalModulesForEnable ¶
func (d Dependencies) DrupalModulesForEnable() []DrupalModuleDependency
func (Dependencies) StrictComposerPackages ¶
func (d Dependencies) StrictComposerPackages() []string
func (Dependencies) StrictDrupalModules ¶
func (d Dependencies) StrictDrupalModules() []DrupalModuleDependency
type DetectOptions ¶
type Disposition ¶ added in v0.9.0
type Disposition string
const ( DispositionDisabled Disposition = "disabled" DispositionSuperseded Disposition = "superceded" DispositionEnabled Disposition = "enabled" DispositionDistributed Disposition = "distributed" DispositionCantaloupe Disposition = "cantaloupe" DispositionTriplet Disposition = "triplet" )
func LegacyDispositionForState ¶ added in v0.9.0
func LegacyDispositionForState(allowed []Disposition, state State) Disposition
func ParseDisposition ¶ added in v0.9.0
func ParseDisposition(value string) (Disposition, error)
func PromptDisposition ¶ added in v0.9.0
func PromptDisposition(name string, guidance StateGuidance, allowed []Disposition, defaultDisposition Disposition, input InputFunc) (Disposition, error)
func ResolveAllowedDisposition ¶ added in v0.9.0
func ResolveAllowedDisposition(allowed []Disposition, disposition Disposition) (Disposition, error)
func ReviewDefaultDisposition ¶ added in v0.9.0
func ReviewDefaultDisposition(view ReviewView) Disposition
func StateToDisposition ¶ added in v0.9.0
func StateToDisposition(state State) Disposition
type DomainSpec ¶
type DomainSpec struct {
Compose YAMLStateSpec `json:"compose,omitempty" yaml:"compose,omitempty"`
Drupal YAMLStateSpec `json:"drupal,omitempty" yaml:"drupal,omitempty"`
Files FileStateSpec `json:"files,omitempty" yaml:"files,omitempty"`
}
type DrupalConfigSet ¶
type DrupalConfigSet struct {
// contains filtered or unexported fields
}
func LoadDrupalConfigSet ¶
func LoadDrupalConfigSet(ctx *config.Context, root string) (*DrupalConfigSet, error)
func NewDrupalConfigSet ¶
func NewDrupalConfigSet(root string, files map[string][]byte) *DrupalConfigSet
func (*DrupalConfigSet) DeleteFiles ¶
func (d *DrupalConfigSet) DeleteFiles(names ...string)
func (*DrupalConfigSet) DeleteMapEntries ¶
func (d *DrupalConfigSet) DeleteMapEntries(match MapEntryMatch) error
func (*DrupalConfigSet) ReplaceString ¶
func (d *DrupalConfigSet) ReplaceString(old, new string)
func (*DrupalConfigSet) UpsertFile ¶
func (d *DrupalConfigSet) UpsertFile(name string, data []byte)
type DrupalLayout ¶
type DrupalLayout struct {
Root string
}
func ResolveDrupalLayout ¶
func ResolveDrupalLayout(projectRoot, drupalRoot string) DrupalLayout
func (DrupalLayout) ComposerJSONPath ¶
func (l DrupalLayout) ComposerJSONPath() string
func (DrupalLayout) ConfigSyncDir ¶
func (l DrupalLayout) ConfigSyncDir() string
type DrupalModuleDependency ¶
type DrupalModuleDependency struct {
Module string `json:"module,omitempty" yaml:"module,omitempty"`
ComposerPackage string `json:"composer_package,omitempty" yaml:"composer_package,omitempty"`
Mode DrupalModuleDependencyMode `json:"mode,omitempty" yaml:"mode,omitempty"`
}
type DrupalModuleDependencyMode ¶
type DrupalModuleDependencyMode string
const ( // DrupalModuleDependencyStrict means the module is part of the component's // core contract and should stay aligned with the component state. DrupalModuleDependencyStrict DrupalModuleDependencyMode = "strict" // DrupalModuleDependencyEnableOnly means the module must exist when the // component is enabled, but disabling the component does not imply removing // or uninstalling the module. DrupalModuleDependencyEnableOnly DrupalModuleDependencyMode = "enable_only" )
type DrupalSpec ¶
type DrupalSpec struct {
ConfigSyncDir string `json:"config_sync_dir,omitempty" yaml:"config_sync_dir,omitempty"`
Files map[string][]byte `json:"files,omitempty" yaml:"files,omitempty"`
DeleteFiles []string `json:"delete_files,omitempty" yaml:"delete_files,omitempty"`
DisableTransforms []DrupalTransform `json:"-" yaml:"-"`
EnableTransforms []DrupalTransform `json:"-" yaml:"-"`
}
type DrupalTransform ¶
type DrupalTransform interface {
Apply(*DrupalConfigSet) error
}
type FileRule ¶ added in v0.18.0
type FileRule struct {
Files []string `json:"files,omitempty" yaml:"files,omitempty"`
Op RuleOp `json:"op,omitempty" yaml:"op,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Value any `json:"value,omitempty" yaml:"value,omitempty"`
StartMarker string `json:"start_marker,omitempty" yaml:"start_marker,omitempty"`
EndMarker string `json:"end_marker,omitempty" yaml:"end_marker,omitempty"`
Content string `json:"content,omitempty" yaml:"content,omitempty"`
}
FileRule describes one project-file mutation or state check.
type FileStateSpec ¶ added in v0.18.0
type FileStateSpec struct {
Rules []FileRule `json:"rules,omitempty" yaml:"rules,omitempty"`
}
FileStateSpec groups project-file rules for a component state.
type FollowUpSpec ¶ added in v0.8.0
type FollowUpSpec struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Label string `json:"label,omitempty" yaml:"label,omitempty"`
FlagName string `json:"flag_name,omitempty" yaml:"flag_name,omitempty"`
FlagUsage string `json:"flag_usage,omitempty" yaml:"flag_usage,omitempty"`
Question string `json:"question,omitempty" yaml:"question,omitempty"`
Choices []Choice `json:"choices,omitempty" yaml:"choices,omitempty"`
DefaultValue string `json:"default_value,omitempty" yaml:"default_value,omitempty"`
PromptOnCreate bool `json:"prompt_on_create,omitempty" yaml:"prompt_on_create,omitempty"`
AppliesTo State `json:"applies_to,omitempty" yaml:"applies_to,omitempty"`
AppliesToDisposition Disposition `json:"applies_to_disposition,omitempty" yaml:"applies_to_disposition,omitempty"`
CustomPrompt string `json:"custom_prompt,omitempty" yaml:"custom_prompt,omitempty"`
}
FollowUpSpec describes a non-secret option collected after a component disposition decision. Follow-up values can be forwarded through plugin RPC passthrough args and may be visible in process listings during interactive calls; do not use follow-ups for tokens, passwords, secret keys, or other sensitive values.
type FollowUpValue ¶ added in v0.8.0
type FollowUpValue struct {
Value string
}
type GateSpec ¶
type GateSpec struct {
LocalOnly bool `json:"local_only,omitempty" yaml:"local_only,omitempty"`
DisableConfirmation string `json:"disable_confirmation,omitempty" yaml:"disable_confirmation,omitempty"`
EnableConfirmation string `json:"enable_confirmation,omitempty" yaml:"enable_confirmation,omitempty"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) DisableComponent ¶
func (m *Manager) DisableComponent(ctx context.Context, spec ComponentSpec) error
func (*Manager) DisableComponentWithOptions ¶
func (m *Manager) DisableComponentWithOptions(ctx context.Context, spec ComponentSpec, opts ApplyOptions) error
func (*Manager) EnableComponent ¶
func (m *Manager) EnableComponent(ctx context.Context, spec ComponentSpec) error
func (*Manager) EnableComponentWithOptions ¶
func (m *Manager) EnableComponentWithOptions(ctx context.Context, spec ComponentSpec, opts ApplyOptions) error
func (*Manager) ReconcileAll ¶
func (*Manager) ReconcileComponent ¶
type MapEntryMatch ¶
type PromptChoiceFunc ¶ added in v0.8.0
type PromptDispositionFunc ¶ added in v0.9.0
type PromptDispositionFunc func(name string, guidance StateGuidance, allowed []Disposition, defaultDisposition Disposition, input InputFunc) (Disposition, error)
type PromptStateFunc ¶ added in v0.7.0
type PromptStateFunc func(name string, guidance StateGuidance, input InputFunc) (State, error)
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (*Registry) Components ¶
func (*Registry) MustRegister ¶
type ReplaceStringsTransform ¶
type ReplaceStringsTransform struct {
Replacements []StringReplacement
}
func (ReplaceStringsTransform) Apply ¶
func (t ReplaceStringsTransform) Apply(set *DrupalConfigSet) error
type RepoSource ¶
type ReportRow ¶ added in v0.7.0
type ReportRow struct {
Name string `json:"name" yaml:"name"`
State string `json:"state" yaml:"state"`
DetectedMode string `json:"detected_mode,omitempty" yaml:"detected_mode,omitempty"`
FollowUps map[string]string `json:"follow_ups,omitempty" yaml:"follow_ups,omitempty"`
CurrentGuidance string `json:"current_guidance,omitempty" yaml:"current_guidance,omitempty"`
IfEnabled string `json:"if_enabled" yaml:"if_enabled"`
IfDisabled string `json:"if_disabled" yaml:"if_disabled"`
DriftDetail string `json:"drift_detail,omitempty" yaml:"drift_detail,omitempty"`
DriftChecks []string `json:"drift_checks,omitempty" yaml:"drift_checks,omitempty"`
}
func BuildComponentStatusRows ¶ added in v0.7.0
func BuildComponentStatusRows(views []ReviewView, verbose bool) []ReportRow
type ReviewConfirmFunc ¶ added in v0.7.0
type ReviewDecision ¶ added in v0.7.0
type ReviewDecision struct {
Disposition Disposition
State State
Options map[string]string
}
type ReviewMode ¶ added in v0.7.0
type ReviewOptions ¶ added in v0.7.0
type ReviewOptions struct {
Input InputFunc
PromptState PromptStateFunc
PromptDisposition PromptDispositionFunc
PromptChoice PromptChoiceFunc
PromptExtra ReviewPromptExtraFunc
SummaryLine SummaryLineFunc
Confirm ReviewConfirmFunc
}
type ReviewPromptExtraFunc ¶ added in v0.7.0
type ReviewPromptExtraFunc func(view ReviewView, decision *ReviewDecision) error
type ReviewView ¶ added in v0.7.0
type ReviewView struct {
Definition Definition
Name string
State DetectedState
Disposition Disposition
Detail string
DriftDetail string
SDKStatus *ComponentStatus
FollowUpValues map[string]string
Extra any
}
type RuleCheckResult ¶
type State ¶
type State string
func DispositionToState ¶ added in v0.9.0
func DispositionToState(disposition Disposition) State
func ParseState ¶
func PromptState ¶
func PromptState(name string, guidance StateGuidance, input InputFunc) (State, error)
func ReviewDefaultState ¶ added in v0.7.0
func ReviewDefaultState(view ReviewView) State
type StateCheck ¶
type StateCheck struct {
State State
Passed int
Failed int
Results []RuleCheckResult
}
type StateGuidance ¶
type StateGuidance struct {
Question string `json:"question,omitempty" yaml:"question,omitempty"`
OnHelp string `json:"on_help,omitempty" yaml:"on_help,omitempty"`
OffHelp string `json:"off_help,omitempty" yaml:"off_help,omitempty"`
DefaultState State `json:"default_state,omitempty" yaml:"default_state,omitempty"`
EnabledHelp string `json:"enabled_help,omitempty" yaml:"enabled_help,omitempty"`
DisabledHelp string `json:"disabled_help,omitempty" yaml:"disabled_help,omitempty"`
SupersededHelp string `json:"superseded_help,omitempty" yaml:"superseded_help,omitempty"`
DistributedHelp string `json:"distributed_help,omitempty" yaml:"distributed_help,omitempty"`
}
type StaticComponent ¶
type StaticComponent struct {
// contains filtered or unexported fields
}
func NewStaticComponent ¶
func NewStaticComponent(name string, defaultState State, on ComponentSpec, off ComponentSpec) StaticComponent
func (StaticComponent) DefaultState ¶
func (f StaticComponent) DefaultState() State
func (StaticComponent) Name ¶
func (f StaticComponent) Name() string
func (StaticComponent) SpecFor ¶
func (f StaticComponent) SpecFor(state State) ComponentSpec
type StringReplacement ¶
type SummaryLineFunc ¶ added in v0.7.0
type SummaryLineFunc func(view ReviewView, decision ReviewDecision) (string, error)
type TransitionBehavior ¶
type TransitionBehavior struct {
DataMigration DataMigrationRequirement `json:"data_migration,omitempty" yaml:"data_migration,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
}
type YAMLDocument ¶
type YAMLDocument struct {
// contains filtered or unexported fields
}
YAMLDocument is an editable YAML document that preserves selected formatting details needed by compose files.
func LoadYAMLDocument ¶
func LoadYAMLDocument(data []byte) (*YAMLDocument, error)
LoadYAMLDocument parses YAML into a mutable document.
func (*YAMLDocument) AppendUniqueString ¶ added in v0.18.0
func (d *YAMLDocument) AppendUniqueString(path, value string) error
AppendUniqueString appends value to a string sequence at path when absent.
func (*YAMLDocument) Bytes ¶
func (d *YAMLDocument) Bytes() ([]byte, error)
Bytes marshals the YAML document back to bytes.
func (*YAMLDocument) DeletePath ¶
func (d *YAMLDocument) DeletePath(path string) error
DeletePath removes a dotted path from the YAML mapping when present.
func (*YAMLDocument) HasPath ¶ added in v0.18.0
func (d *YAMLDocument) HasPath(path string) (bool, error)
HasPath reports whether a dotted YAML path exists.
func (*YAMLDocument) RemoveMatchingString ¶ added in v0.18.0
RemoveMatchingString removes string values matching match from a scalar or sequence at path. It returns true when the document changed.
func (*YAMLDocument) RemoveString ¶ added in v0.18.0
func (d *YAMLDocument) RemoveString(path, value string) error
RemoveString removes value from a string sequence or matching scalar at path.
func (*YAMLDocument) SetString ¶
func (d *YAMLDocument) SetString(path, value string) error
SetString writes a string scalar at a dotted YAML path.
type YAMLRule ¶
type YAMLRule struct {
Files []string `json:"files,omitempty" yaml:"files,omitempty"`
Exclude []string `json:"exclude,omitempty" yaml:"exclude,omitempty"`
SourceFiles []string `json:"source_files,omitempty" yaml:"source_files,omitempty"`
Op RuleOp `json:"op,omitempty" yaml:"op,omitempty"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Value any `json:"value,omitempty" yaml:"value,omitempty"`
Old any `json:"old,omitempty" yaml:"old,omitempty"`
}
type YAMLStateSpec ¶
type YAMLStateSpec struct {
Canonical []RepoSource `json:"canonical,omitempty" yaml:"canonical,omitempty"`
Rules []YAMLRule `json:"rules,omitempty" yaml:"rules,omitempty"`
}