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

vswitch

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: 10 Imported by: 0

Documentation

Overview

Package vswitch implements the hyperv_virtual_switch data source: read-only access to an existing switch by name. Mirrors the resource's read fields but writes no state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() datasource.DataSource

New is the framework factory.

Types

type DataSource

type DataSource struct {
	// contains filtered or unexported fields
}

DataSource implements data.hyperv_virtual_switch.

func (*DataSource) Configure

Configure stashes the typed Hyper-V client built by the provider's Configure pass. Skips when ProviderData is nil (validate-time invocation before the provider has resolved its config).

func (*DataSource) Metadata

Metadata sets the data source's TF type name.

func (*DataSource) Read

Read fetches the switch via Get-VMSwitch and writes the typed result into state. ErrNotFound surfaces as an attribute-anchored diagnostic so the operator sees which `name` didn't resolve; ErrUnavailable surfaces with transient phrasing so a vmms blip doesn't read like "the switch is gone".

func (*DataSource) Schema

Schema declares name as the lookup key (Required); everything else is read-only Computed pulled from Get-VMSwitch. net_adapter_names is absent, since Get-VMSwitch doesn't return the originally-supplied adapter list, only the teamed adapter's description. nat_name is Optional: without it a NAT switch reads back as its underlying Internal VMSwitch with empty NAT fields; setting it joins Get-NetNat so switch_type reports "NAT" with nat_* populated.

type Model

type Model struct {
	Name                           types.String `tfsdk:"name"`
	NatName                        types.String `tfsdk:"nat_name"`
	ID                             types.String `tfsdk:"id"`
	SwitchType                     types.String `tfsdk:"switch_type"`
	AllowManagementOS              types.Bool   `tfsdk:"allow_management_os"`
	Notes                          types.String `tfsdk:"notes"`
	NetAdapterInterfaceDescription types.String `tfsdk:"net_adapter_interface_description"`
	NatInternalAddressPrefix       types.String `tfsdk:"nat_internal_address_prefix"`
	NatHostAddress                 types.String `tfsdk:"nat_host_address"`
}

Model is the tfsdk-bound state struct.

Jump to

Keyboard shortcuts

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