vsphere/resource_vsphere_datastore_cluster.go
func expandStorageDrsSpaceLoadBalanceConfig(
	d *schema.ResourceData,
	version viapi.VSphereVersion,
) *types.StorageDrsSpaceLoadBalanceConfig {
	obj := &types.StorageDrsSpaceLoadBalanceConfig{
		MinSpaceUtilizationDifference: int32(d.Get("sdrs_free_space_utilization_difference").(int)),
		SpaceUtilizationThreshold:     int32(d.Get("sdrs_space_utilization_threshold").(int)),
	}

	if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) {
		obj.FreeSpaceThresholdGB = int32(d.Get("sdrs_free_space_threshold").(int))
		obj.SpaceThresholdMode = d.Get("sdrs_free_space_threshold_mode").(string)
	}

	return obj
}
func expandStorageDrsSpaceLoadBalanceConfig(
	d *schema.ResourceData,
	version viapi.VSphereVersion,
) *types.StorageDrsSpaceLoadBalanceConfig {
	obj := &types.StorageDrsSpaceLoadBalanceConfig{
		MinSpaceUtilizationDifference: int32(d.Get("sdrs_free_space_utilization_difference").(int)),
		SpaceUtilizationThreshold:     int32(d.Get("sdrs_space_utilization_threshold").(int)),
	}

	if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) {
		obj.FreeSpaceThresholdGB = int32(d.Get("sdrs_free_space_threshold").(int))
		obj.SpaceThresholdMode = d.Get("sdrs_free_space_threshold_mode").(string)
	}

	return obj
}
// expandStorageDrsSpaceLoadBalanceConfig reads certain ResourceData keys and returns
// a StorageDrsSpaceLoadBalanceConfig.