github.com/databricks/cli@v0.203.0/bundle/deploy/files/sync.go (about)

     1  package files
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/databricks/cli/bundle"
     8  	"github.com/databricks/cli/libs/sync"
     9  )
    10  
    11  func getSync(ctx context.Context, b *bundle.Bundle) (*sync.Sync, error) {
    12  	cacheDir, err := b.CacheDir()
    13  	if err != nil {
    14  		return nil, fmt.Errorf("cannot get bundle cache directory: %w", err)
    15  	}
    16  
    17  	opts := sync.SyncOptions{
    18  		LocalPath:   b.Config.Path,
    19  		RemotePath:  b.Config.Workspace.FilesPath,
    20  		Full:        false,
    21  		CurrentUser: b.Config.Workspace.CurrentUser.User,
    22  
    23  		SnapshotBasePath: cacheDir,
    24  		WorkspaceClient:  b.WorkspaceClient(),
    25  	}
    26  	return sync.New(ctx, opts)
    27  }