github.com/databricks/cli@v0.203.0/bundle/deploy/files/upload.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/cmdio"
     9  )
    10  
    11  type upload struct{}
    12  
    13  func (m *upload) Name() string {
    14  	return "files.Upload"
    15  }
    16  
    17  func (m *upload) Apply(ctx context.Context, b *bundle.Bundle) error {
    18  	cmdio.LogString(ctx, "Starting upload of bundle files")
    19  	sync, err := getSync(ctx, b)
    20  	if err != nil {
    21  		return err
    22  	}
    23  
    24  	err = sync.RunOnce(ctx)
    25  	if err != nil {
    26  		return err
    27  	}
    28  
    29  	cmdio.LogString(ctx, fmt.Sprintf("Uploaded bundle files at %s!\n", b.Config.Workspace.FilesPath))
    30  	return nil
    31  }
    32  
    33  func Upload() bundle.Mutator {
    34  	return &upload{}
    35  }