vsphere/resource_vsphere_datastore_cluster.go
func resourceVSphereDatastoreClusterApplySDRSConfig(d *schema.ResourceData, meta interface{}, pod *object.StoragePod) error {
	// This is a no-op if there is no SDRS config changed
	if !resourceVSphereDatastoreClusterHasSDRSConfigChange(d) {
		log.Printf("[DEBUG] %s: No SDRS configuration attributes have changed", resourceVSphereDatastoreClusterIDString(d))
		return nil
	}

	log.Printf("[DEBUG] %s: Applying SDRS configuration", resourceVSphereDatastoreClusterIDString(d))
	client := meta.(*VSphereClient).vimClient
	if err := viapi.ValidateVirtualCenter(client); err != nil {
		return err
	}

	// Get the version of the vSphere connection to help determine what
	// attributes we need to set
	version := viapi.ParseVersionFromClient(client)

	// Expand the SDRS configuration.
	spec := types.StorageDrsConfigSpec{
		PodConfigSpec: expandStorageDrsPodConfigSpec(d, version),
	}

	return storagepod.ApplyDRSConfiguration(client, pod, spec)
}
func resourceVSphereDatastoreClusterApplySDRSConfig(d *schema.ResourceData, meta interface{}, pod *object.StoragePod) error {
	// This is a no-op if there is no SDRS config changed
	if !resourceVSphereDatastoreClusterHasSDRSConfigChange(d) {
		log.Printf("[DEBUG] %s: No SDRS configuration attributes have changed", resourceVSphereDatastoreClusterIDString(d))
		return nil
	}

	log.Printf("[DEBUG] %s: Applying SDRS configuration", resourceVSphereDatastoreClusterIDString(d))
	client := meta.(*VSphereClient).vimClient
	if err := viapi.ValidateVirtualCenter(client); err != nil {
		return err
	}

	// Get the version of the vSphere connection to help determine what
	// attributes we need to set
	version := viapi.ParseVersionFromClient(client)

	// Expand the SDRS configuration.
	spec := types.StorageDrsConfigSpec{
		PodConfigSpec: expandStorageDrsPodConfigSpec(d, version),
	}

	return storagepod.ApplyDRSConfiguration(client, pod, spec)
}
// resourceVSphereDatastoreClusterApplySDRSConfig applies the SDRS
// configuration to a datastore cluster.