vsphere/distributed_virtual_port_setting_structure.go
func flattenVMwareDVSPortSetting(d *schema.ResourceData, obj *types.VMwareDVSPortSetting) error {
	if obj == nil {
		return nil
	}

	structure.SetBoolPolicy(d, "block_all_ports", obj.Blocked)
	structure.SetBoolPolicy(d, "netflow_enabled", obj.IpfixEnabled)
	structure.SetBoolPolicy(d, "tx_uplink", obj.TxUplink)
	structure.SetBoolPolicy(d, "directpath_gen2_allowed", obj.VmDirectPathGen2Allowed)

	if err := flattenDVSTrafficShapingPolicyIngress(d, obj.InShapingPolicy); err != nil {
		return err
	}
	if err := flattenDVSTrafficShapingPolicyEgress(d, obj.OutShapingPolicy); err != nil {
		return err
	}
	if err := flattenBaseVmwareDistributedVirtualSwitchVlanSpec(d, obj.Vlan); err != nil {
		return err
	}
	if err := flattenVmwareUplinkPortTeamingPolicy(d, obj.UplinkTeamingPolicy); err != nil {
		return err
	}
	if err := flattenDVSSecurityPolicy(d, obj.SecurityPolicy); err != nil {
		return err
	}
	if err := flattenVMwareUplinkLacpPolicy(d, obj.LacpPolicy); err != nil {
		return err
	}
	return nil
}
func flattenVMwareDVSPortSetting(d *schema.ResourceData, obj *types.VMwareDVSPortSetting) error {
	if obj == nil {
		return nil
	}

	structure.SetBoolPolicy(d, "block_all_ports", obj.Blocked)
	structure.SetBoolPolicy(d, "netflow_enabled", obj.IpfixEnabled)
	structure.SetBoolPolicy(d, "tx_uplink", obj.TxUplink)
	structure.SetBoolPolicy(d, "directpath_gen2_allowed", obj.VmDirectPathGen2Allowed)

	if err := flattenDVSTrafficShapingPolicyIngress(d, obj.InShapingPolicy); err != nil {
		return err
	}
	if err := flattenDVSTrafficShapingPolicyEgress(d, obj.OutShapingPolicy); err != nil {
		return err
	}
	if err := flattenBaseVmwareDistributedVirtualSwitchVlanSpec(d, obj.Vlan); err != nil {
		return err
	}
	if err := flattenVmwareUplinkPortTeamingPolicy(d, obj.UplinkTeamingPolicy); err != nil {
		return err
	}
	if err := flattenDVSSecurityPolicy(d, obj.SecurityPolicy); err != nil {
		return err
	}
	if err := flattenVMwareUplinkLacpPolicy(d, obj.LacpPolicy); err != nil {
		return err
	}
	return nil
}
// flattenVMwareDVSPortSetting reads various fields from a
// VMwareDVSPortSetting into the passed in ResourceData.