vswitch

package
v0.0.0-...-ab035be Latest Latest
Warning

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

Go to latest
Published: Apr 28, 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 shape 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 shape into state. ErrNotFound surfaces as an attribute-anchored diagnostic so the operator sees which `name` value didn't resolve. ErrUnavailable surfaces with transient phrasing so a vmms blip during a plan doesn't read like "the switch is gone".

func (*DataSource) Schema

Schema declares the data source's read shape: name is the lookup key (Required); everything else is read-only Computed pulled from Get-VMSwitch.

net_adapter_names is intentionally absent -- the resource preserves it as user intent, but Get-VMSwitch doesn't return the originally-supplied adapter-name list (only NetAdapterInterfaceDescription, which is the teamed adapter's friendly description). Exposing only what the cmdlet actually returns avoids a phantom field that we can't reliably populate.

type Model

type Model struct {
	Name                           types.String `tfsdk:"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"`
}

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