vsphere/distributed_virtual_port_setting_structure.go
func expandBaseVmwareDistributedVirtualSwitchVlanSpec(d *schema.ResourceData) types.BaseVmwareDistributedVirtualSwitchVlanSpec {
	var obj types.BaseVmwareDistributedVirtualSwitchVlanSpec

	_, ide := d.GetOkExists("vlan_id")
	_, pvid := d.GetOkExists("port_private_secondary_vlan_id")
	vteList, vteOK := d.GetOkExists("vlan_range")
	vte := vteOK && len(vteList.(*schema.Set).List()) > 0
	switch {
	case vte:
		obj = expandVmwareDistributedVirtualSwitchTrunkVlanSpec(d)
	case pvid:
		obj = expandVmwareDistributedVirtualSwitchPvlanSpec(d)
	case ide:
		obj = expandVmwareDistributedVirtualSwitchVlanIDSpec(d)
	}

	return obj
}
func expandBaseVmwareDistributedVirtualSwitchVlanSpec(d *schema.ResourceData) types.BaseVmwareDistributedVirtualSwitchVlanSpec {
	var obj types.BaseVmwareDistributedVirtualSwitchVlanSpec

	_, ide := d.GetOkExists("vlan_id")
	_, pvid := d.GetOkExists("port_private_secondary_vlan_id")
	vteList, vteOK := d.GetOkExists("vlan_range")
	vte := vteOK && len(vteList.(*schema.Set).List()) > 0
	switch {
	case vte:
		obj = expandVmwareDistributedVirtualSwitchTrunkVlanSpec(d)
	case pvid:
		obj = expandVmwareDistributedVirtualSwitchPvlanSpec(d)
	case ide:
		obj = expandVmwareDistributedVirtualSwitchVlanIDSpec(d)
	}

	return obj
}
// expandBaseVmwareDistributedVirtualSwitchVlanSpec reads certain ResourceData keys and
// returns a BaseVmwareDistributedVirtualSwitchVlanSpec.