func resourceVSphereDatastoreClusterApplyFolderChange(
	d *schema.ResourceData,
	meta interface{},
	pod *object.StoragePod,
) (*object.StoragePod, error) {
	log.Printf(
		"[DEBUG] %s: Applying any folder changes (old path = %q)",
		resourceVSphereDatastoreClusterIDString(d),
		pod.InventoryPath,
	)

	var changed bool
	var err error

	if d.HasChange("folder") {
		f := d.Get("folder").(string)
		client := meta.(*VSphereClient).vimClient
		if err = storagepod.MoveToFolder(client, pod, f); err != nil {
			return nil, fmt.Errorf("could not move datastore cluster to folder %q: %s", f, err)
		}
		changed = true
	}

	if changed {
		// Update the pod so that we have the new inventory path for logging and
		// other things
		pod, err = resourceVSphereDatastoreClusterGetPod(d, meta)
		if err != nil {
			return nil, fmt.Errorf("error refreshing pod after folder change: %s", err)
		}
		log.Printf(
			"[DEBUG] %s: Folder changed, new path = %q",
			resourceVSphereDatastoreClusterIDString(d),
			pod.InventoryPath,
		)
	}

	return pod, nil
}
func resourceVSphereDatastoreClusterApplyFolderChange(
	d *schema.ResourceData,
	meta interface{},
	pod *object.StoragePod,
) (*object.StoragePod, error) {
	log.Printf(
		"[DEBUG] %s: Applying any folder changes (old path = %q)",
		resourceVSphereDatastoreClusterIDString(d),
		pod.InventoryPath,
	)

	var changed bool
	var err error

	if d.HasChange("folder") {
		f := d.Get("folder").(string)
		client := meta.(*VSphereClient).vimClient
		if err = storagepod.MoveToFolder(client, pod, f); err != nil {
			return nil, fmt.Errorf("could not move datastore cluster to folder %q: %s", f, err)
		}
		changed = true
	}

	if changed {
		// Update the pod so that we have the new inventory path for logging and
		// other things
		pod, err = resourceVSphereDatastoreClusterGetPod(d, meta)
		if err != nil {
			return nil, fmt.Errorf("error refreshing pod after folder change: %s", err)
		}
		log.Printf(
			"[DEBUG] %s: Folder changed, new path = %q",
			resourceVSphereDatastoreClusterIDString(d),
			pod.InventoryPath,
		)
	}

	return pod, nil
}
func resourceVSphereDatastoreClusterApplyFolderChange ( d * schema . ResourceData , meta interface { } , pod * object . StoragePod , ) ( * object . StoragePod , error ) { log . Printf ( " " , resourceVSphereDatastoreClusterIDString ( d ) , pod . InventoryPath , ) var changed bool var err error if d . HasChange ( " " ) { f := d . Get ( " " ) . ( string ) client := meta . ( * VSphereClient ) . vimClient if err = storagepod . MoveToFolder ( client , pod , f ) ; err != nil { return nil , fmt . Errorf ( " " , f , err ) } changed = true } if changed { // Update the pod so that we have the new inventory path for logging and // other things pod , err = resourceVSphereDatastoreClusterGetPod ( d , meta ) if err != nil { return nil , fmt . Errorf ( " " , err ) } log . Printf ( " " , resourceVSphereDatastoreClusterIDString ( d ) , pod . InventoryPath , ) } return pod , nil }
// resourceVSphereDatastoreClusterApplyFolderChange applies any changes to a
// StoragePod's folder location.
resourceVSphereDatastoreClusterApplyFolderChange applies any changes to a StoragePod s folder location .