vsphere/distributed_virtual_switch_structure.go
func flattenVMwareDVSConfigInfo(d *schema.ResourceData, obj *types.VMwareDVSConfigInfo) error {
	d.Set("name", obj.Name)
	d.Set("config_version", obj.ConfigVersion)
	d.Set("description", obj.Description)
	d.Set("ipv4_address", obj.SwitchIpAddress)
	d.Set("max_mtu", obj.MaxMtu)
	d.Set("lacp_api_version", obj.LacpApiVersion)
	d.Set("multicast_filtering_mode", obj.MulticastFilteringMode)
	d.Set("network_resource_control_version", obj.NetworkResourceControlVersion)
	// This is not available in ConfigSpec but is available in ConfigInfo, so
	// flatten it here.
	d.Set("network_resource_control_enabled", obj.NetworkResourceManagementEnabled)

	// Version is set in this object too as ConfigInfo has the productInfo
	// property that is outside of this ConfigSpec structure.
	d.Set("version", obj.ProductInfo.Version)

	if err := flattenDVSNameArrayUplinkPortPolicy(d, obj.UplinkPortPolicy.(*types.DVSNameArrayUplinkPortPolicy)); err != nil {
		return err
	}
	if err := flattenVMwareDVSPortSetting(d, obj.DefaultPortConfig.(*types.VMwareDVSPortSetting)); err != nil {
		return err
	}
	if err := flattenSliceOfDistributedVirtualSwitchHostMember(d, obj.Host); err != nil {
		return err
	}
	if err := flattenSliceOfDvsHostInfrastructureTrafficResource(d, obj.InfrastructureTrafficResourceConfig); err != nil {
		return err
	}
	if err := flattenDVSContactInfo(d, obj.Contact); err != nil {
		return err
	}
	if err := flattenLinkDiscoveryProtocolConfig(d, obj.LinkDiscoveryProtocolConfig); err != nil {
		return err
	}
	if err := flattenVMwareIpfixConfig(d, obj.IpfixConfig); err != nil {
		return err
	}
	return nil
}
func flattenVMwareDVSConfigInfo(d *schema.ResourceData, obj *types.VMwareDVSConfigInfo) error {
	d.Set("name", obj.Name)
	d.Set("config_version", obj.ConfigVersion)
	d.Set("description", obj.Description)
	d.Set("ipv4_address", obj.SwitchIpAddress)
	d.Set("max_mtu", obj.MaxMtu)
	d.Set("lacp_api_version", obj.LacpApiVersion)
	d.Set("multicast_filtering_mode", obj.MulticastFilteringMode)
	d.Set("network_resource_control_version", obj.NetworkResourceControlVersion)
	// This is not available in ConfigSpec but is available in ConfigInfo, so
	// flatten it here.
	d.Set("network_resource_control_enabled", obj.NetworkResourceManagementEnabled)

	// Version is set in this object too as ConfigInfo has the productInfo
	// property that is outside of this ConfigSpec structure.
	d.Set("version", obj.ProductInfo.Version)

	if err := flattenDVSNameArrayUplinkPortPolicy(d, obj.UplinkPortPolicy.(*types.DVSNameArrayUplinkPortPolicy)); err != nil {
		return err
	}
	if err := flattenVMwareDVSPortSetting(d, obj.DefaultPortConfig.(*types.VMwareDVSPortSetting)); err != nil {
		return err
	}
	if err := flattenSliceOfDistributedVirtualSwitchHostMember(d, obj.Host); err != nil {
		return err
	}
	if err := flattenSliceOfDvsHostInfrastructureTrafficResource(d, obj.InfrastructureTrafficResourceConfig); err != nil {
		return err
	}
	if err := flattenDVSContactInfo(d, obj.Contact); err != nil {
		return err
	}
	if err := flattenLinkDiscoveryProtocolConfig(d, obj.LinkDiscoveryProtocolConfig); err != nil {
		return err
	}
	if err := flattenVMwareIpfixConfig(d, obj.IpfixConfig); err != nil {
		return err
	}
	return nil
}
// flattenVMwareDVSConfigInfo reads various fields from a
// VMwareDVSConfigInfo into the passed in ResourceData.
//
// This is the flatten counterpart to expandVMwareDVSConfigSpec, as the
// configuration info from a DVS comes back as this type instead of a specific
// ConfigSpec.