Documentation
¶
Overview ¶
Package scripts embeds the PowerShell scripts the provider runs against the host, one subdirectory per resource family. The typed Hyper-V client (internal/hyperv) concatenates common/preamble.ps1 to the top of each resource script per the §5 contract.
Index ¶
- Variables
- func ImageFileScript(verb string) ([]byte, error)
- func NatStaticMappingRetry() ([]byte, error)
- func NatStaticMappingScript(verb string) ([]byte, error)
- func NetNatScript(verb string) ([]byte, error)
- func Preamble() ([]byte, error)
- func VHDScript(verb string) ([]byte, error)
- func VMReadResult() ([]byte, error)
- func VMScript(verb string) ([]byte, error)
- func VswitchScript(verb string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
var Common embed.FS
Common holds preamble and shared helpers — exposed because the typed client prepends preamble.ps1 to every resource-script body before sending it through the connection layer.
var ImageFile embed.FS
ImageFile holds the verb scripts for hyperv_image_file (M4). No "set" verb -- every image_file schema field is RequiresReplace, so Update is a Go-side no-op with no PS round-trip.
var NatStaticMapping embed.FS
NatStaticMapping holds the four verb scripts for hyperv_nat_static_mapping plus the shared _retry.ps1 helper prepended to new/set on the Go side (mirror of the vm/read-result.ps1 pattern). Pester *.Tests.ps1 and the _test_helpers.ps1 stub file are deliberately excluded from the embed glob.
var NetNat embed.FS
NetNat holds the sweep script for orphan-NetNat cleanup, used by the acceptance-test sweeper. Production CRUD on NetNat lives inside vswitch/{new,remove}.ps1 and nat_static_mapping/*.ps1.
var VHD embed.FS
VHD holds the verb scripts for hyperv_vhd (M4). The "set" verb only resizes -- every other attribute is RequiresReplace at the schema layer.
var VM embed.FS
VM holds the verb scripts for hyperv_vm, plus per-attachment add/remove scripts, each with its own cmdlet and error mapping instead of set.ps1.
var Vswitch embed.FS
Vswitch holds the four verb scripts for hyperv_virtual_switch. The typed client reads each by path and concatenates the preamble before invoking. Pester *.Tests.ps1 and the _test_helpers.ps1 stub file are deliberately excluded from the embed glob — production Go has no use for them.
Functions ¶
func ImageFileScript ¶
ImageFileScript returns the contents of image_file/<verb>.ps1 (verb in {get, new, remove, sweep}).
func NatStaticMappingRetry ¶ added in v0.3.0
NatStaticMappingRetry returns nat_static_mapping/_retry.ps1, the shared Invoke-WithDupNameRetry helper. The Go-side hyperv.Client prepends its body to the new and set verb scripts at runtime.
func NatStaticMappingScript ¶ added in v0.3.0
NatStaticMappingScript returns the contents of nat_static_mapping/<verb>.ps1 (verb in {get, new, set, remove}).
func NetNatScript ¶ added in v0.3.0
NetNatScript returns the contents of netnat/<verb>.ps1.
func Preamble ¶
Preamble returns the contents of common/preamble.ps1. Convenience wrapper so callers don't have to repeat the path string.
func VHDScript ¶
VHDScript returns the contents of vhd/<verb>.ps1 (verb in {get, new, set, remove}).
func VMReadResult ¶
VMReadResult returns vm/read-result.ps1, the canonical Read-HypervVMResult function shared by the four VM read-emitting scripts (get/new/set/set-state). The Go-side hyperv.Client prepends its body to those scripts at runtime.
func VMScript ¶
VMScript returns the contents of vm/<verb>.ps1. `verb` is the file name without extension: get/new/set/remove for the base verbs, or the hyphenated cmdlet name for an attachment verb ("add-hard-disk-drive").
func VswitchScript ¶
VswitchScript returns the contents of vswitch/<verb>.ps1 (verb in {get, new, set, remove}). Centralizes the path joining so callers don't repeat the "vswitch/" prefix and a typo'd verb fails loudly at startup (via embed_test.go) rather than at first apply.
Types ¶
This section is empty.