vsphere/distributed_virtual_switch_structure.go
func flattenDvsHostInfrastructureTrafficResource(d *schema.ResourceData, obj types.DvsHostInfrastructureTrafficResource, key string) error {
	shareLevelKey := fmt.Sprintf("%s_share_level", strings.ToLower(key))
	shareCountKey := fmt.Sprintf("%s_share_count", strings.ToLower(key))
	maxMbitKey := fmt.Sprintf("%s_maximum_mbit", strings.ToLower(key))
	resMbitKey := fmt.Sprintf("%s_reservation_mbit", strings.ToLower(key))

	structure.SetInt64Ptr(d, maxMbitKey, obj.AllocationInfo.Limit)
	structure.SetInt64Ptr(d, resMbitKey, obj.AllocationInfo.Reservation)
	if obj.AllocationInfo.Shares != nil {
		d.Set(shareLevelKey, obj.AllocationInfo.Shares.Level)
		d.Set(shareCountKey, obj.AllocationInfo.Shares.Shares)
	}
	return nil
}
func flattenDvsHostInfrastructureTrafficResource(d *schema.ResourceData, obj types.DvsHostInfrastructureTrafficResource, key string) error {
	shareLevelKey := fmt.Sprintf("%s_share_level", strings.ToLower(key))
	shareCountKey := fmt.Sprintf("%s_share_count", strings.ToLower(key))
	maxMbitKey := fmt.Sprintf("%s_maximum_mbit", strings.ToLower(key))
	resMbitKey := fmt.Sprintf("%s_reservation_mbit", strings.ToLower(key))

	structure.SetInt64Ptr(d, maxMbitKey, obj.AllocationInfo.Limit)
	structure.SetInt64Ptr(d, resMbitKey, obj.AllocationInfo.Reservation)
	if obj.AllocationInfo.Shares != nil {
		d.Set(shareLevelKey, obj.AllocationInfo.Shares.Level)
		d.Set(shareCountKey, obj.AllocationInfo.Shares.Shares)
	}
	return nil
}
// flattenDvsHostInfrastructureTrafficResource reads various fields from a
// DvsHostInfrastructureTrafficResource and sets appropriate keys in the
// supplied ResourceData.