module

package
v1.0.0-beta.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: ISC Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func Decode[T any](params map[string]any, dest *T) error

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

func EnsureApply(module, ensure string, presentApply, absentApply func() error) error

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

func PreservesSecretRefs(name string) bool

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.

func RejectParams

func RejectParams(module string, params map[string]any, keys ...string) error

Types

type DirectoryModule

type DirectoryModule struct{}

func (*DirectoryModule) Apply

func (*DirectoryModule) Check

type DirectoryParams

type DirectoryParams struct {
	Path   string `param:"path,required"`
	Ensure string `param:"ensure" default:"present"`
}

type EnvironmentModule

type EnvironmentModule struct{}

func (*EnvironmentModule) Apply

func (*EnvironmentModule) Check

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 FileParams struct {
	Dest    string `param:"dest,required"`
	Ensure  string `param:"ensure" default:"present"`
	Src     string `param:"src"`
	Content string `param:"content"`
}

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 PipeResult struct {
	Lines   []string
	ScanErr error
}

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 PowershellApplyParams struct {
	Script     string            `param:"script"`
	File       string            `param:"file"`
	Args       []string          `param:"args"`
	WorkingDir string            `param:"working_dir"`
	Env        map[string]string `param:"env"`
}

type PowershellCheckParams

type PowershellCheckParams struct {
	CheckScript string            `param:"check_script"`
	Creates     string            `param:"creates"`
	WorkingDir  string            `param:"working_dir"`
	Env         map[string]string `param:"env"`
}

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 (*RebootModule) Check

type RebootParams

type RebootParams struct {
	Condition string `param:"condition" default:"if_needed"`
	Timeout   int    `param:"timeout" default:"60"`
}

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 ShellApplyParams struct {
	Cmd        string            `param:"cmd,required"`
	Args       []string          `param:"args"`
	WorkingDir string            `param:"working_dir"`
	Env        map[string]string `param:"env"`
}

type ShellCheckParams

type ShellCheckParams struct {
	Creates    string `param:"creates"`
	WorkingDir string `param:"working_dir"`
}

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 WaitParams struct {
	Condition string `param:"condition,required"`
	Target    string `param:"target,required"`
	Timeout   string `param:"timeout" default:"5m"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL