Help us shape the future of Go! Take the 2026 Go Developer Survey

scripts

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MPL-2.0 Imports: 1 Imported by: 0

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

Constants

This section is empty.

Variables

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

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

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

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

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

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.

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

func ImageFileScript(verb string) ([]byte, error)

ImageFileScript returns the contents of image_file/<verb>.ps1 (verb in {get, new, remove, sweep}).

func NatStaticMappingRetry added in v0.3.0

func NatStaticMappingRetry() ([]byte, error)

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

func NatStaticMappingScript(verb string) ([]byte, error)

NatStaticMappingScript returns the contents of nat_static_mapping/<verb>.ps1 (verb in {get, new, set, remove}).

func NetNatScript added in v0.3.0

func NetNatScript(verb string) ([]byte, error)

NetNatScript returns the contents of netnat/<verb>.ps1.

func Preamble

func Preamble() ([]byte, error)

Preamble returns the contents of common/preamble.ps1. Convenience wrapper so callers don't have to repeat the path string.

func VHDScript

func VHDScript(verb string) ([]byte, error)

VHDScript returns the contents of vhd/<verb>.ps1 (verb in {get, new, set, remove}).

func VMReadResult

func VMReadResult() ([]byte, error)

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

func VMScript(verb string) ([]byte, error)

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

func VswitchScript(verb string) ([]byte, error)

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.

Jump to

Keyboard shortcuts

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