Previously if we had multiple SharePoint document libs, we would have merged the contents of both in the export. This separates it by document lib. After: - DocumentLibA/FileA - DocumentLibB/FileB Before: - FileA - FileB --- #### Does this PR need a docs update or release note? - [x] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [ ] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
74 lines
1.9 KiB
Go
74 lines
1.9 KiB
Go
package m365
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/alcionai/clues"
|
|
|
|
"github.com/alcionai/corso/src/internal/data"
|
|
"github.com/alcionai/corso/src/internal/diagnostics"
|
|
"github.com/alcionai/corso/src/internal/m365/graph"
|
|
"github.com/alcionai/corso/src/internal/m365/service/onedrive"
|
|
"github.com/alcionai/corso/src/internal/m365/service/sharepoint"
|
|
"github.com/alcionai/corso/src/internal/m365/support"
|
|
"github.com/alcionai/corso/src/pkg/backup/details"
|
|
"github.com/alcionai/corso/src/pkg/control"
|
|
"github.com/alcionai/corso/src/pkg/export"
|
|
"github.com/alcionai/corso/src/pkg/fault"
|
|
"github.com/alcionai/corso/src/pkg/selectors"
|
|
)
|
|
|
|
// ProduceExportCollections exports data from the specified collections
|
|
func (ctrl *Controller) ProduceExportCollections(
|
|
ctx context.Context,
|
|
backupVersion int,
|
|
sels selectors.Selector,
|
|
exportCfg control.ExportConfig,
|
|
opts control.Options,
|
|
dcs []data.RestoreCollection,
|
|
errs *fault.Bus,
|
|
) ([]export.Collection, error) {
|
|
ctx, end := diagnostics.Span(ctx, "m365:export")
|
|
defer end()
|
|
|
|
ctx = graph.BindRateLimiterConfig(ctx, graph.LimiterCfg{Service: sels.PathService()})
|
|
ctx = clues.Add(ctx, "export_config", exportCfg) // TODO(meain): needs PII control
|
|
|
|
var (
|
|
expCollections []export.Collection
|
|
status *support.ControllerOperationStatus
|
|
deets = &details.Builder{}
|
|
err error
|
|
)
|
|
|
|
switch sels.Service {
|
|
case selectors.ServiceOneDrive:
|
|
expCollections, err = onedrive.ProduceExportCollections(
|
|
ctx,
|
|
backupVersion,
|
|
exportCfg,
|
|
opts,
|
|
dcs,
|
|
deets,
|
|
errs)
|
|
case selectors.ServiceSharePoint:
|
|
expCollections, err = sharepoint.ProduceExportCollections(
|
|
ctx,
|
|
backupVersion,
|
|
exportCfg,
|
|
opts,
|
|
dcs,
|
|
ctrl.backupDriveIDNames,
|
|
deets,
|
|
errs)
|
|
|
|
default:
|
|
err = clues.Wrap(clues.New(sels.Service.String()), "service not supported")
|
|
}
|
|
|
|
ctrl.incrementAwaitingMessages()
|
|
ctrl.UpdateStatus(status)
|
|
|
|
return expCollections, err
|
|
}
|