vsphere/resource_vsphere_datastore_cluster.go
func flattenStorageDrsPodConfigInfo(d *schema.ResourceData, obj types.StorageDrsPodConfigInfo, version viapi.VSphereVersion) error {
	attrs := map[string]interface{}{
		"sdrs_default_intra_vm_affinity": obj.DefaultIntraVmAffinity,
		"sdrs_automation_level":          obj.DefaultVmBehavior,
		"sdrs_enabled":                   obj.Enabled,
		"sdrs_io_load_balance_enabled":   obj.IoLoadBalanceEnabled,
		"sdrs_load_balance_interval":     obj.LoadBalanceInterval,
	}
	for k, v := range attrs {
		if err := d.Set(k, v); err != nil {
			return fmt.Errorf("error setting attribute %q: %s", k, err)
		}
	}

	if err := flattenStorageDrsIoLoadBalanceConfig(d, obj.IoLoadBalanceConfig, version); err != nil {
		return err
	}

	if err := flattenStorageDrsSpaceLoadBalanceConfig(d, obj.SpaceLoadBalanceConfig, version); err != nil {
		return err
	}

	if err := flattenStorageDrsOptionSpec(d, obj.Option); err != nil {
		return err
	}

	if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) {
		if err := flattenStorageDrsAutomationConfig(d, obj.AutomationOverrides); err != nil {
			return err
		}
	}

	return nil
}
func flattenStorageDrsPodConfigInfo(d *schema.ResourceData, obj types.StorageDrsPodConfigInfo, version viapi.VSphereVersion) error {
	attrs := map[string]interface{}{
		"sdrs_default_intra_vm_affinity": obj.DefaultIntraVmAffinity,
		"sdrs_automation_level":          obj.DefaultVmBehavior,
		"sdrs_enabled":                   obj.Enabled,
		"sdrs_io_load_balance_enabled":   obj.IoLoadBalanceEnabled,
		"sdrs_load_balance_interval":     obj.LoadBalanceInterval,
	}
	for k, v := range attrs {
		if err := d.Set(k, v); err != nil {
			return fmt.Errorf("error setting attribute %q: %s", k, err)
		}
	}

	if err := flattenStorageDrsIoLoadBalanceConfig(d, obj.IoLoadBalanceConfig, version); err != nil {
		return err
	}

	if err := flattenStorageDrsSpaceLoadBalanceConfig(d, obj.SpaceLoadBalanceConfig, version); err != nil {
		return err
	}

	if err := flattenStorageDrsOptionSpec(d, obj.Option); err != nil {
		return err
	}

	if version.Newer(viapi.VSphereVersion{Product: version.Product, Major: 6}) {
		if err := flattenStorageDrsAutomationConfig(d, obj.AutomationOverrides); err != nil {
			return err
		}
	}

	return nil
}
func flattenStorageDrsPodConfigInfo ( d * schema . ResourceData , obj types . StorageDrsPodConfigInfo , version viapi . VSphereVersion ) error { attrs := map [ string ] interface { } { " " : obj . DefaultIntraVmAffinity , " " : obj . DefaultVmBehavior , " " : obj . Enabled , " " : obj . IoLoadBalanceEnabled , " " : obj . LoadBalanceInterval , } for k , v := range attrs { if err := d . Set ( k , v ) ; err != nil { return fmt . Errorf ( " " , k , err ) } } if err := flattenStorageDrsIoLoadBalanceConfig ( d , obj . IoLoadBalanceConfig , version ) ; err != nil { return err } if err := flattenStorageDrsSpaceLoadBalanceConfig ( d , obj . SpaceLoadBalanceConfig , version ) ; err != nil { return err } if err := flattenStorageDrsOptionSpec ( d , obj . Option ) ; err != nil { return err } if version . Newer ( viapi . VSphereVersion { Product : version . Product , Major : 6 } ) { if err := flattenStorageDrsAutomationConfig ( d , obj . AutomationOverrides ) ; err != nil { return err } } return nil }
// flattenStorageDrsPodConfigInfo saves a StorageDrsPodConfigInfo into the
// supplied ResourceData.
flattenStorageDrsPodConfigInfo saves a StorageDrsPodConfigInfo into the supplied ResourceData .