Documentation
¶
Index ¶
- Variables
- func Decode[T any](params map[string]any, dest *T) error
- func EnsureApply(module, ensure string, presentApply, absentApply func() error) error
- func EnsureCheck(module, ensure string, presentCheck, absentCheck func() (bool, error)) (bool, error)
- func NewOutputPipe(onOutput target.OutputFunc) (w *io.PipeWriter, done <-chan PipeResult)
- func PreservesSecretRefs(name string) bool
- func Registry() target.ModuleRegistry
- func RejectParams(module string, params map[string]any, keys ...string) error
- type DirectoryModule
- type DirectoryParams
- type EnvironmentModule
- type EnvironmentParams
- type FileModule
- type FileParams
- type FirewallRuleParams
- type PipeResult
- type PowerPlanParams
- type PowershellApplyParams
- type PowershellCheckParams
- type PowershellModule
- type RebootModule
- type RebootParams
- type RegistryParams
- type ScheduledTaskParams
- type ServiceParams
- type ShellApplyParams
- type ShellCheckParams
- type ShellModule
- type ShortcutParams
- type UserParams
- type WaitModule
- type WaitParams
- type WindowsFeatureParams
Constants ¶
This section is empty.
Variables ¶
var WindowsModuleNames = []string{
"registry",
"service",
"package",
"shortcut",
"scheduled_task",
"user",
"winget_package",
"remove_appx_packages",
"power_plan",
"windows_feature",
"firewall_rule",
}
WindowsModuleNames is the canonical list of Windows-only module names. It serves as the single source of truth for both the Windows native registrations (module_windows.go) and the cross-platform stubs (windows_stub.go). Add a new name here and a corresponding entry in windowsModuleTypes (in module_windows.go) to register a new module.
Functions ¶
func Decode ¶
Decode maps a raw params map into a typed struct using `param` tags. Tags: `param:"key,required"`, defaults via `default:"value"` struct tag.
func EnsureApply ¶
EnsureApply dispatches to presentApply or absentApply based on the ensure value.
func EnsureCheck ¶
func EnsureCheck(module, ensure string, presentCheck, absentCheck func() (bool, error)) (bool, error)
EnsureCheck dispatches to presentCheck or absentCheck based on the ensure value.
func NewOutputPipe ¶
func NewOutputPipe(onOutput target.OutputFunc) (w *io.PipeWriter, done <-chan PipeResult)
func PreservesSecretRefs ¶
PreservesSecretRefs reports whether the named module requires template rendering to preserve secret refs rather than resolving them eagerly. The file module defers secret resolution because content_template is bound as a late step after main param rendering.
func Registry ¶
func Registry() target.ModuleRegistry
Registry returns a map of all built-in module names to their implementations.
Types ¶
type DirectoryModule ¶
type DirectoryModule struct{}
func (*DirectoryModule) Apply ¶
func (m *DirectoryModule) Apply(_ context.Context, params map[string]any, _ target.OutputFunc) (target.ApplyResult, error)
func (*DirectoryModule) Check ¶
func (m *DirectoryModule) Check(_ context.Context, params map[string]any, _ target.OutputFunc) (target.CheckResult, error)
type DirectoryParams ¶
type EnvironmentModule ¶
type EnvironmentModule struct{}
func (*EnvironmentModule) Apply ¶
func (m *EnvironmentModule) Apply(_ context.Context, params map[string]any, _ target.OutputFunc) (target.ApplyResult, error)
func (*EnvironmentModule) Check ¶
func (m *EnvironmentModule) Check(_ context.Context, params map[string]any, _ target.OutputFunc) (target.CheckResult, error)
type EnvironmentParams ¶
type EnvironmentParams struct {
Name string `param:"name,required"`
Value string `param:"value"`
Scope string `param:"scope"`
Ensure string `param:"ensure" default:"present"`
}
EnvironmentParams are the typed parameters for the environment module.
type FileModule ¶
type FileModule struct{}
func (*FileModule) Apply ¶
func (m *FileModule) Apply(_ context.Context, params map[string]any, _ target.OutputFunc) (target.ApplyResult, error)
func (*FileModule) Check ¶
func (m *FileModule) Check(_ context.Context, params map[string]any, _ target.OutputFunc) (target.CheckResult, error)
type FileParams ¶
type FirewallRuleParams ¶
type FirewallRuleParams struct {
Name string `param:"name,required"`
Ensure string `param:"ensure" default:"present"`
Direction string `param:"direction"`
Action string `param:"action"`
Protocol string `param:"protocol"`
}
FirewallRuleParams are the typed parameters for the firewall_rule module.
type PipeResult ¶
type PowerPlanParams ¶
type PowerPlanParams struct {
Name string `param:"name,required"`
Ensure string `param:"ensure" default:"present"`
}
PowerPlanParams are the typed parameters for the power_plan module.
type PowershellApplyParams ¶
type PowershellCheckParams ¶
type PowershellModule ¶
type PowershellModule struct{}
PowershellModule runs PowerShell scripts or files. On non-Windows platforms, attempts to exec `powershell` (WSL/cross-platform compat). Params:
- script: inline PowerShell script string
- file: path to a .ps1 file
- args: list of additional arguments (used with file)
- check_script: inline PowerShell script that returns whether a change is needed
- creates: path that indicates the operation is already done
func (*PowershellModule) Apply ¶
func (m *PowershellModule) Apply(ctx context.Context, params map[string]any, out target.OutputFunc) (target.ApplyResult, error)
func (*PowershellModule) Check ¶
func (m *PowershellModule) Check(ctx context.Context, params map[string]any, out target.OutputFunc) (target.CheckResult, error)
type RebootModule ¶
type RebootModule struct{}
func (*RebootModule) Apply ¶
func (m *RebootModule) Apply(_ context.Context, params map[string]any, _ target.OutputFunc) (target.ApplyResult, error)
func (*RebootModule) Check ¶
func (m *RebootModule) Check(_ context.Context, params map[string]any, _ target.OutputFunc) (target.CheckResult, error)
type RebootParams ¶
type RegistryParams ¶
type RegistryParams struct {
Path string `param:"path,required"`
User string `param:"user"`
Ensure string `param:"ensure" default:"present"`
}
RegistryParams are the typed parameters for the registry module (Go-side validation only).
type ScheduledTaskParams ¶
type ScheduledTaskParams struct {
Name string `param:"name,required"`
}
ScheduledTaskParams are the typed parameters for the scheduled_task module (Go-side validation only).
type ServiceParams ¶
type ServiceParams struct {
Name string `param:"name,required"`
State string `param:"state"`
StartupType string `param:"startup_type"`
}
ServiceParams are the typed parameters for the service module.
type ShellApplyParams ¶
type ShellCheckParams ¶
type ShellModule ¶
type ShellModule struct{}
func (*ShellModule) Apply ¶
func (m *ShellModule) Apply(ctx context.Context, params map[string]any, out target.OutputFunc) (target.ApplyResult, error)
func (*ShellModule) Check ¶
func (m *ShellModule) Check(_ context.Context, params map[string]any, _ target.OutputFunc) (target.CheckResult, error)
type ShortcutParams ¶
type ShortcutParams struct {
Destination string `param:"destination,required"`
Ensure string `param:"ensure" default:"present"`
Target string `param:"target"`
Args string `param:"args"`
Icon string `param:"icon"`
}
ShortcutParams are the typed parameters for the shortcut module.
type UserParams ¶
type UserParams struct {
Name string `param:"name,required"`
Ensure string `param:"ensure" default:"present"`
Password string `param:"password"`
Groups []string `param:"groups"`
}
UserParams are the typed parameters for the user module.
type WaitModule ¶
type WaitModule struct{}
func (*WaitModule) Apply ¶
func (m *WaitModule) Apply(ctx context.Context, params map[string]any, _ target.OutputFunc) (target.ApplyResult, error)
func (*WaitModule) Check ¶
func (m *WaitModule) Check(_ context.Context, params map[string]any, _ target.OutputFunc) (target.CheckResult, error)
type WaitParams ¶
type WindowsFeatureParams ¶
type WindowsFeatureParams struct {
Name string `param:"name,required"`
Ensure string `param:"ensure" default:"present"`
}
WindowsFeatureParams are the typed parameters for the windows_feature module.