code: func flattenStorageDrsSpaceLoadBalanceConfig(
  	d *schema.ResourceData,
  	obj *types.StorageDrsSpaceLoadBalanceConfig,
  	version viapi.VSphereVersion,
  ) error {
  	attrs := map[string]interface{}{
  		"sdrs_free_space_utilization_difference": obj.MinSpaceUtilizationDifference,
  		"sdrs_free_space_threshold_mode":         obj.SpaceThresholdMode,
  	}
  
  	freeSpaceSupported := version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6})
  	if freeSpaceSupported && obj.SpaceThresholdMode == string(types.StorageDrsSpaceLoadBalanceConfigSpaceThresholdModeFreeSpace) {
  		attrs["sdrs_free_space_threshold"] = obj.FreeSpaceThresholdGB
  	} else {
  		attrs["sdrs_space_utilization_threshold"] = obj.SpaceUtilizationThreshold
  	}
  
  	for k, v := range attrs {
  		if err := d.Set(k, v); err != nil {
  			return fmt.Errorf("error setting attribute %q: %s", k, err)
  		}
  	}
  
  	return nil
  }
docs: // flattenStorageDrsSpaceLoadBalanceConfig saves a
  // StorageDrsSpaceLoadBalanceConfig into the supplied ResourceData.