MCPcopy
hub / github.com/harness/harness / ExportProgress

Method ExportProgress

app/api/controller/space/export_progress.go:35–53  ·  view source on GitHub ↗

ExportProgress returns progress of the export job.

(ctx context.Context,
	session *auth.Session,
	spaceRef string,
)

Source from the content-addressed store, hash-verified

33
34// ExportProgress returns progress of the export job.
35func (c *Controller) ExportProgress(ctx context.Context,
36 session *auth.Session,
37 spaceRef string,
38) (ExportProgressOutput, error) {
39 space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceView)
40 if err != nil {
41 return ExportProgressOutput{}, fmt.Errorf("failed to acquire access to space: %w", err)
42 }
43
44 progress, err := c.exporter.GetProgressForSpace(ctx, space.ID)
45 if errors.Is(err, exporter.ErrNotFound) {
46 return ExportProgressOutput{}, usererror.NotFound("No recent or ongoing export found for space.")
47 }
48 if err != nil {
49 return ExportProgressOutput{}, fmt.Errorf("failed to retrieve export progress: %w", err)
50 }
51
52 return ExportProgressOutput{Repos: progress}, nil
53}

Callers 1

HandleExportProgressFunction · 0.80

Calls 5

getSpaceCheckAuthMethod · 0.95
NotFoundFunction · 0.92
GetProgressForSpaceMethod · 0.80
ErrorfMethod · 0.45
IsMethod · 0.45

Tested by

no test coverage detected