vsphere/resource_vsphere_datastore_cluster.go
func expandStorageDrsIoLoadBalanceConfig(d *schema.ResourceData, version viapi.VSphereVersion) *types.StorageDrsIoLoadBalanceConfig {
	obj := &types.StorageDrsIoLoadBalanceConfig{
		IoLatencyThreshold:       int32(d.Get("sdrs_io_latency_threshold").(int)),
		IoLoadImbalanceThreshold: int32(d.Get("sdrs_io_load_imbalance_threshold").(int)),
	}

	if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) {
		obj.ReservableIopsThreshold = int32(d.Get("sdrs_io_reservable_iops_threshold").(int))
		obj.ReservablePercentThreshold = int32(d.Get("sdrs_io_reservable_percent_threshold").(int))
		obj.ReservableThresholdMode = d.Get("sdrs_io_reservable_threshold_mode").(string)
	}

	return obj
}
func expandStorageDrsIoLoadBalanceConfig(d *schema.ResourceData, version viapi.VSphereVersion) *types.StorageDrsIoLoadBalanceConfig {
	obj := &types.StorageDrsIoLoadBalanceConfig{
		IoLatencyThreshold:       int32(d.Get("sdrs_io_latency_threshold").(int)),
		IoLoadImbalanceThreshold: int32(d.Get("sdrs_io_load_imbalance_threshold").(int)),
	}

	if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) {
		obj.ReservableIopsThreshold = int32(d.Get("sdrs_io_reservable_iops_threshold").(int))
		obj.ReservablePercentThreshold = int32(d.Get("sdrs_io_reservable_percent_threshold").(int))
		obj.ReservableThresholdMode = d.Get("sdrs_io_reservable_threshold_mode").(string)
	}

	return obj
}
// expandStorageDrsIoLoadBalanceConfig reads certain ResourceData keys and returns
// a StorageDrsIoLoadBalanceConfig.