diff --git a/src/internal/m365/collection/drive/collections_test.go b/src/internal/m365/collection/drive/collections_test.go index af801e07c5..9a5fd5e81d 100644 --- a/src/internal/m365/collection/drive/collections_test.go +++ b/src/internal/m365/collection/drive/collections_test.go @@ -131,7 +131,7 @@ func (suite *OneDriveCollectionsUnitSuite) TestUpdateCollections() { pkg = "/package" ) - bh := itemBackupHandler{userID: user} + bh := userDriveBackupHandler{userID: user} testBaseDrivePath := odConsts.DriveFolderPrefixBuilder("driveID1").String() expectedPath := getExpectedPathGenerator(suite.T(), bh, tenant, testBaseDrivePath) expectedStatePath := getExpectedStatePathGenerator(suite.T(), bh, tenant, testBaseDrivePath) @@ -740,8 +740,8 @@ func (suite *OneDriveCollectionsUnitSuite) TestUpdateCollections() { maps.Copy(currPrevPaths, test.inputFolderMap) c := NewCollections( - &itemBackupHandler{ - baseItemHandler: baseItemHandler{ + &userDriveBackupHandler{ + baseUserDriveHandler: baseUserDriveHandler{ ac: api.Drives{}, }, userID: user, @@ -1196,7 +1196,7 @@ func (suite *OneDriveCollectionsUnitSuite) TestGet() { drive2.SetName(&driveID2) var ( - bh = itemBackupHandler{userID: user} + bh = userDriveBackupHandler{userID: user} driveBasePath1 = odConsts.DriveFolderPrefixBuilder(driveID1).String() driveBasePath2 = odConsts.DriveFolderPrefixBuilder(driveID2).String() @@ -2468,8 +2468,8 @@ func (suite *OneDriveCollectionsUnitSuite) TestAddURLCacheToDriveCollections() { // Add a few collections for i := 0; i < collCount; i++ { coll, err := NewCollection( - &itemBackupHandler{ - baseItemHandler: baseItemHandler{ + &userDriveBackupHandler{ + baseUserDriveHandler: baseUserDriveHandler{ ac: api.Drives{}, }, userID: "test-user", diff --git a/src/internal/m365/collection/drive/group_handler.go b/src/internal/m365/collection/drive/group_handler.go index 2b445e9608..a603ce748c 100644 --- a/src/internal/m365/collection/drive/group_handler.go +++ b/src/internal/m365/collection/drive/group_handler.go @@ -16,7 +16,7 @@ import ( var _ BackupHandler = &groupBackupHandler{} type groupBackupHandler struct { - libraryBackupHandler + siteBackupHandler groupID string scope selectors.GroupsScope } @@ -27,8 +27,8 @@ func NewGroupBackupHandler( scope selectors.GroupsScope, ) groupBackupHandler { return groupBackupHandler{ - libraryBackupHandler{ - baseLibraryHandler: baseLibraryHandler{ + siteBackupHandler{ + baseSiteHandler: baseSiteHandler{ ac: ac, }, siteID: siteID, diff --git a/src/internal/m365/collection/drive/group_handler_test.go b/src/internal/m365/collection/drive/group_handler_test.go index ada9d77f89..85eca7439c 100644 --- a/src/internal/m365/collection/drive/group_handler_test.go +++ b/src/internal/m365/collection/drive/group_handler_test.go @@ -141,7 +141,7 @@ func (suite *GroupBackupHandlerUnitSuite) TestServiceCat() { t := suite.T() s, c := groupBackupHandler{ - libraryBackupHandler: libraryBackupHandler{service: path.GroupsService}, + siteBackupHandler: siteBackupHandler{service: path.GroupsService}, }.ServiceCat() assert.Equal(t, path.GroupsService, s) assert.Equal(t, path.LibrariesCategory, c) diff --git a/src/internal/m365/collection/drive/item_collector_test.go b/src/internal/m365/collection/drive/item_collector_test.go index 762e5c10f3..30bdc4661c 100644 --- a/src/internal/m365/collection/drive/item_collector_test.go +++ b/src/internal/m365/collection/drive/item_collector_test.go @@ -266,8 +266,8 @@ func (suite *OneDriveIntgSuite) TestOneDriveNewCollections() { ) colls := NewCollections( - &itemBackupHandler{ - baseItemHandler: baseItemHandler{ + &userDriveBackupHandler{ + baseUserDriveHandler: baseUserDriveHandler{ ac: suite.ac.Drives(), }, userID: test.user, diff --git a/src/internal/m365/collection/drive/item_test.go b/src/internal/m365/collection/drive/item_test.go index e3abfa60f6..b63aa1c02d 100644 --- a/src/internal/m365/collection/drive/item_test.go +++ b/src/internal/m365/collection/drive/item_test.go @@ -80,7 +80,7 @@ func (suite *ItemIntegrationSuite) TestItemWriter() { for _, test := range table { suite.Run(test.name, func() { t := suite.T() - rh := NewRestoreHandler(suite.service.ac) + rh := NewUserDriveRestoreHandler(suite.service.ac) ctx, flush := tester.NewContext(t) defer flush() diff --git a/src/internal/m365/collection/drive/library_handler.go b/src/internal/m365/collection/drive/site_handler.go similarity index 75% rename from src/internal/m365/collection/drive/library_handler.go rename to src/internal/m365/collection/drive/site_handler.go index 95bebb0bdf..532f32e0f3 100644 --- a/src/internal/m365/collection/drive/library_handler.go +++ b/src/internal/m365/collection/drive/site_handler.go @@ -18,18 +18,18 @@ import ( "github.com/alcionai/corso/src/pkg/services/m365/api" ) -type baseLibraryHandler struct { +type baseSiteHandler struct { ac api.Drives } -func (h baseLibraryHandler) NewDrivePager( +func (h baseSiteHandler) NewDrivePager( resourceOwner string, fields []string, ) api.Pager[models.Driveable] { return h.ac.NewSiteDrivePager(resourceOwner, fields) } -func (h baseLibraryHandler) AugmentItemInfo( +func (h baseSiteHandler) AugmentItemInfo( dii details.ItemInfo, resource idname.Provider, item models.DriveItemable, @@ -62,23 +62,23 @@ func (h baseLibraryHandler) AugmentItemInfo( return dii } -var _ BackupHandler = &libraryBackupHandler{} +var _ BackupHandler = &siteBackupHandler{} -type libraryBackupHandler struct { - baseLibraryHandler +type siteBackupHandler struct { + baseSiteHandler siteID string scope selectors.SharePointScope service path.ServiceType } -func NewLibraryBackupHandler( +func NewSiteBackupHandler( ac api.Drives, siteID string, scope selectors.SharePointScope, service path.ServiceType, -) libraryBackupHandler { - return libraryBackupHandler{ - baseLibraryHandler: baseLibraryHandler{ +) siteBackupHandler { + return siteBackupHandler{ + baseSiteHandler: baseSiteHandler{ ac: ac, }, siteID: siteID, @@ -87,7 +87,7 @@ func NewLibraryBackupHandler( } } -func (h libraryBackupHandler) Get( +func (h siteBackupHandler) Get( ctx context.Context, url string, headers map[string]string, @@ -95,7 +95,7 @@ func (h libraryBackupHandler) Get( return h.ac.Get(ctx, url, headers) } -func (h libraryBackupHandler) PathPrefix( +func (h siteBackupHandler) PathPrefix( tenantID, driveID string, ) (path.Path, error) { return path.Build( @@ -109,7 +109,7 @@ func (h libraryBackupHandler) PathPrefix( odConsts.RootPathDir) } -func (h libraryBackupHandler) MetadataPathPrefix( +func (h siteBackupHandler) MetadataPathPrefix( tenantID string, ) (path.Path, error) { p, err := path.BuildMetadata( @@ -125,54 +125,54 @@ func (h libraryBackupHandler) MetadataPathPrefix( return p, nil } -func (h libraryBackupHandler) CanonicalPath( +func (h siteBackupHandler) CanonicalPath( folders *path.Builder, tenantID string, ) (path.Path, error) { return folders.ToDataLayerPath(tenantID, h.siteID, h.service, path.LibrariesCategory, false) } -func (h libraryBackupHandler) ServiceCat() (path.ServiceType, path.CategoryType) { +func (h siteBackupHandler) ServiceCat() (path.ServiceType, path.CategoryType) { return h.service, path.LibrariesCategory } -func (h libraryBackupHandler) FormatDisplayPath( +func (h siteBackupHandler) FormatDisplayPath( driveName string, pb *path.Builder, ) string { return "/" + driveName + "/" + pb.String() } -func (h libraryBackupHandler) NewLocationIDer( +func (h siteBackupHandler) NewLocationIDer( driveID string, elems ...string, ) details.LocationIDer { return details.NewSharePointLocationIDer(driveID, elems...) } -func (h libraryBackupHandler) GetItemPermission( +func (h siteBackupHandler) GetItemPermission( ctx context.Context, driveID, itemID string, ) (models.PermissionCollectionResponseable, error) { return h.ac.GetItemPermission(ctx, driveID, itemID) } -func (h libraryBackupHandler) GetItem( +func (h siteBackupHandler) GetItem( ctx context.Context, driveID, itemID string, ) (models.DriveItemable, error) { return h.ac.GetItem(ctx, driveID, itemID) } -func (h libraryBackupHandler) IsAllPass() bool { +func (h siteBackupHandler) IsAllPass() bool { return h.scope.IsAny(selectors.SharePointLibraryFolder) } -func (h libraryBackupHandler) IncludesDir(dir string) bool { +func (h siteBackupHandler) IncludesDir(dir string) bool { return h.scope.Matches(selectors.SharePointLibraryFolder, dir) } -func (h libraryBackupHandler) EnumerateDriveItemsDelta( +func (h siteBackupHandler) EnumerateDriveItemsDelta( ctx context.Context, driveID, prevDeltaLink string, selectProps []string, @@ -184,17 +184,17 @@ func (h libraryBackupHandler) EnumerateDriveItemsDelta( // Restore // --------------------------------------------------------------------------- -var _ RestoreHandler = &libraryRestoreHandler{} +var _ RestoreHandler = &siteRestoreHandler{} -type libraryRestoreHandler struct { - baseLibraryHandler +type siteRestoreHandler struct { + baseSiteHandler ac api.Client service path.ServiceType } -func NewLibraryRestoreHandler(ac api.Client, service path.ServiceType) libraryRestoreHandler { - return libraryRestoreHandler{ - baseLibraryHandler: baseLibraryHandler{ +func NewSiteRestoreHandler(ac api.Client, service path.ServiceType) siteRestoreHandler { + return siteRestoreHandler{ + baseSiteHandler: baseSiteHandler{ ac: ac.Drives(), }, ac: ac, @@ -202,28 +202,28 @@ func NewLibraryRestoreHandler(ac api.Client, service path.ServiceType) libraryRe } } -func (h libraryRestoreHandler) PostDrive( +func (h siteRestoreHandler) PostDrive( ctx context.Context, siteID, driveName string, ) (models.Driveable, error) { return h.ac.Lists().PostDrive(ctx, siteID, driveName) } -func (h libraryRestoreHandler) DeleteItem( +func (h siteRestoreHandler) DeleteItem( ctx context.Context, driveID, itemID string, ) error { return h.ac.Drives().DeleteItem(ctx, driveID, itemID) } -func (h libraryRestoreHandler) DeleteItemPermission( +func (h siteRestoreHandler) DeleteItemPermission( ctx context.Context, driveID, itemID, permissionID string, ) error { return h.ac.Drives().DeleteItemPermission(ctx, driveID, itemID, permissionID) } -func (h libraryRestoreHandler) GetItemsInContainerByCollisionKey( +func (h siteRestoreHandler) GetItemsInContainerByCollisionKey( ctx context.Context, driveID, containerID string, ) (map[string]api.DriveItemIDType, error) { @@ -235,14 +235,14 @@ func (h libraryRestoreHandler) GetItemsInContainerByCollisionKey( return m, nil } -func (h libraryRestoreHandler) NewItemContentUpload( +func (h siteRestoreHandler) NewItemContentUpload( ctx context.Context, driveID, itemID string, ) (models.UploadSessionable, error) { return h.ac.Drives().NewItemContentUpload(ctx, driveID, itemID) } -func (h libraryRestoreHandler) PostItemPermissionUpdate( +func (h siteRestoreHandler) PostItemPermissionUpdate( ctx context.Context, driveID, itemID string, body *drives.ItemItemsItemInvitePostRequestBody, @@ -250,7 +250,7 @@ func (h libraryRestoreHandler) PostItemPermissionUpdate( return h.ac.Drives().PostItemPermissionUpdate(ctx, driveID, itemID, body) } -func (h libraryRestoreHandler) PostItemLinkShareUpdate( +func (h siteRestoreHandler) PostItemLinkShareUpdate( ctx context.Context, driveID, itemID string, body *drives.ItemItemsItemCreateLinkPostRequestBody, @@ -258,7 +258,7 @@ func (h libraryRestoreHandler) PostItemLinkShareUpdate( return h.ac.Drives().PostItemLinkShareUpdate(ctx, driveID, itemID, body) } -func (h libraryRestoreHandler) PostItemInContainer( +func (h siteRestoreHandler) PostItemInContainer( ctx context.Context, driveID, parentFolderID string, newItem models.DriveItemable, @@ -267,14 +267,14 @@ func (h libraryRestoreHandler) PostItemInContainer( return h.ac.Drives().PostItemInContainer(ctx, driveID, parentFolderID, newItem, onCollision) } -func (h libraryRestoreHandler) GetFolderByName( +func (h siteRestoreHandler) GetFolderByName( ctx context.Context, driveID, parentFolderID, folderName string, ) (models.DriveItemable, error) { return h.ac.Drives().GetFolderByName(ctx, driveID, parentFolderID, folderName) } -func (h libraryRestoreHandler) GetRootFolder( +func (h siteRestoreHandler) GetRootFolder( ctx context.Context, driveID string, ) (models.DriveItemable, error) { diff --git a/src/internal/m365/collection/drive/library_handler_test.go b/src/internal/m365/collection/drive/site_handler_test.go similarity index 88% rename from src/internal/m365/collection/drive/library_handler_test.go rename to src/internal/m365/collection/drive/site_handler_test.go index f31e78984f..478b0876bd 100644 --- a/src/internal/m365/collection/drive/library_handler_test.go +++ b/src/internal/m365/collection/drive/site_handler_test.go @@ -36,7 +36,7 @@ func (suite *LibraryBackupHandlerUnitSuite) TestPathPrefix() { for _, test := range table { suite.Run(test.name, func() { t := suite.T() - h := libraryBackupHandler{service: path.SharePointService, siteID: resourceOwner} + h := siteBackupHandler{service: path.SharePointService, siteID: resourceOwner} result, err := h.PathPrefix(tenantID, "driveID") test.expectErr(t, err, clues.ToCore(err)) @@ -65,7 +65,7 @@ func (suite *LibraryBackupHandlerUnitSuite) TestMetadataPathPrefix() { for _, test := range table { suite.Run(test.name, func() { t := suite.T() - h := libraryBackupHandler{service: path.SharePointService, siteID: resourceOwner} + h := siteBackupHandler{service: path.SharePointService, siteID: resourceOwner} result, err := h.MetadataPathPrefix(tenantID) test.expectErr(t, err, clues.ToCore(err)) @@ -94,7 +94,7 @@ func (suite *LibraryBackupHandlerUnitSuite) TestCanonicalPath() { for _, test := range table { suite.Run(test.name, func() { t := suite.T() - h := libraryBackupHandler{service: path.SharePointService, siteID: resourceOwner} + h := siteBackupHandler{service: path.SharePointService, siteID: resourceOwner} p := path.Builder{}.Append("prefix") result, err := h.CanonicalPath(p, tenantID) @@ -110,7 +110,7 @@ func (suite *LibraryBackupHandlerUnitSuite) TestCanonicalPath() { func (suite *LibraryBackupHandlerUnitSuite) TestServiceCat() { t := suite.T() - s, c := libraryBackupHandler{service: path.SharePointService}.ServiceCat() + s, c := siteBackupHandler{service: path.SharePointService}.ServiceCat() assert.Equal(t, path.SharePointService, s) assert.Equal(t, path.LibrariesCategory, c) } diff --git a/src/internal/m365/collection/drive/item_handler.go b/src/internal/m365/collection/drive/user_drive_handler.go similarity index 74% rename from src/internal/m365/collection/drive/item_handler.go rename to src/internal/m365/collection/drive/user_drive_handler.go index c89062dd70..c8ee568827 100644 --- a/src/internal/m365/collection/drive/item_handler.go +++ b/src/internal/m365/collection/drive/user_drive_handler.go @@ -22,11 +22,11 @@ import ( // backup // --------------------------------------------------------------------------- -type baseItemHandler struct { +type baseUserDriveHandler struct { ac api.Drives } -func (h baseItemHandler) NewDrivePager( +func (h baseUserDriveHandler) NewDrivePager( resourceOwner string, fields []string, ) api.Pager[models.Driveable] { @@ -38,7 +38,7 @@ func (h baseItemHandler) NewDrivePager( // separately for restore processes because the local itemable // doesn't have its size value updated as a side effect of creation, // and kiota drops any SetSize update. -func (h baseItemHandler) AugmentItemInfo( +func (h baseUserDriveHandler) AugmentItemInfo( dii details.ItemInfo, resource idname.Provider, item models.DriveItemable, @@ -69,17 +69,17 @@ func (h baseItemHandler) AugmentItemInfo( return dii } -var _ BackupHandler = &itemBackupHandler{} +var _ BackupHandler = &userDriveBackupHandler{} -type itemBackupHandler struct { - baseItemHandler +type userDriveBackupHandler struct { + baseUserDriveHandler userID string scope selectors.OneDriveScope } -func NewItemBackupHandler(ac api.Drives, userID string, scope selectors.OneDriveScope) *itemBackupHandler { - return &itemBackupHandler{ - baseItemHandler: baseItemHandler{ +func NewUserDriveBackupHandler(ac api.Drives, userID string, scope selectors.OneDriveScope) *userDriveBackupHandler { + return &userDriveBackupHandler{ + baseUserDriveHandler: baseUserDriveHandler{ ac: ac, }, userID: userID, @@ -87,7 +87,7 @@ func NewItemBackupHandler(ac api.Drives, userID string, scope selectors.OneDrive } } -func (h itemBackupHandler) Get( +func (h userDriveBackupHandler) Get( ctx context.Context, url string, headers map[string]string, @@ -95,7 +95,7 @@ func (h itemBackupHandler) Get( return h.ac.Get(ctx, url, headers) } -func (h itemBackupHandler) PathPrefix( +func (h userDriveBackupHandler) PathPrefix( tenantID, driveID string, ) (path.Path, error) { return path.Build( @@ -109,7 +109,7 @@ func (h itemBackupHandler) PathPrefix( odConsts.RootPathDir) } -func (h itemBackupHandler) MetadataPathPrefix( +func (h userDriveBackupHandler) MetadataPathPrefix( tenantID string, ) (path.Path, error) { p, err := path.BuildMetadata( @@ -125,54 +125,54 @@ func (h itemBackupHandler) MetadataPathPrefix( return p, nil } -func (h itemBackupHandler) CanonicalPath( +func (h userDriveBackupHandler) CanonicalPath( folders *path.Builder, tenantID string, ) (path.Path, error) { return folders.ToDataLayerOneDrivePath(tenantID, h.userID, false) } -func (h itemBackupHandler) ServiceCat() (path.ServiceType, path.CategoryType) { +func (h userDriveBackupHandler) ServiceCat() (path.ServiceType, path.CategoryType) { return path.OneDriveService, path.FilesCategory } -func (h itemBackupHandler) FormatDisplayPath( +func (h userDriveBackupHandler) FormatDisplayPath( _ string, // drive name not displayed for onedrive pb *path.Builder, ) string { return "/" + pb.String() } -func (h itemBackupHandler) NewLocationIDer( +func (h userDriveBackupHandler) NewLocationIDer( driveID string, elems ...string, ) details.LocationIDer { return details.NewOneDriveLocationIDer(driveID, elems...) } -func (h itemBackupHandler) GetItemPermission( +func (h userDriveBackupHandler) GetItemPermission( ctx context.Context, driveID, itemID string, ) (models.PermissionCollectionResponseable, error) { return h.ac.GetItemPermission(ctx, driveID, itemID) } -func (h itemBackupHandler) GetItem( +func (h userDriveBackupHandler) GetItem( ctx context.Context, driveID, itemID string, ) (models.DriveItemable, error) { return h.ac.GetItem(ctx, driveID, itemID) } -func (h itemBackupHandler) IsAllPass() bool { +func (h userDriveBackupHandler) IsAllPass() bool { return h.scope.IsAny(selectors.OneDriveFolder) } -func (h itemBackupHandler) IncludesDir(dir string) bool { +func (h userDriveBackupHandler) IncludesDir(dir string) bool { return h.scope.Matches(selectors.OneDriveFolder, dir) } -func (h itemBackupHandler) EnumerateDriveItemsDelta( +func (h userDriveBackupHandler) EnumerateDriveItemsDelta( ctx context.Context, driveID, prevDeltaLink string, selectProps []string, @@ -184,42 +184,42 @@ func (h itemBackupHandler) EnumerateDriveItemsDelta( // Restore // --------------------------------------------------------------------------- -var _ RestoreHandler = &itemRestoreHandler{} +var _ RestoreHandler = &userDriveRestoreHandler{} -type itemRestoreHandler struct { - baseItemHandler +type userDriveRestoreHandler struct { + baseUserDriveHandler } -func NewRestoreHandler(ac api.Client) *itemRestoreHandler { - return &itemRestoreHandler{ - baseItemHandler: baseItemHandler{ +func NewUserDriveRestoreHandler(ac api.Client) *userDriveRestoreHandler { + return &userDriveRestoreHandler{ + baseUserDriveHandler: baseUserDriveHandler{ ac: ac.Drives(), }, } } -func (h itemRestoreHandler) PostDrive( +func (h userDriveRestoreHandler) PostDrive( context.Context, string, string, ) (models.Driveable, error) { return nil, clues.New("creating drives in oneDrive is not supported") } -func (h itemRestoreHandler) DeleteItem( +func (h userDriveRestoreHandler) DeleteItem( ctx context.Context, driveID, itemID string, ) error { return h.ac.DeleteItem(ctx, driveID, itemID) } -func (h itemRestoreHandler) DeleteItemPermission( +func (h userDriveRestoreHandler) DeleteItemPermission( ctx context.Context, driveID, itemID, permissionID string, ) error { return h.ac.DeleteItemPermission(ctx, driveID, itemID, permissionID) } -func (h itemRestoreHandler) GetItemsInContainerByCollisionKey( +func (h userDriveRestoreHandler) GetItemsInContainerByCollisionKey( ctx context.Context, driveID, containerID string, ) (map[string]api.DriveItemIDType, error) { @@ -231,14 +231,14 @@ func (h itemRestoreHandler) GetItemsInContainerByCollisionKey( return m, nil } -func (h itemRestoreHandler) NewItemContentUpload( +func (h userDriveRestoreHandler) NewItemContentUpload( ctx context.Context, driveID, itemID string, ) (models.UploadSessionable, error) { return h.ac.NewItemContentUpload(ctx, driveID, itemID) } -func (h itemRestoreHandler) PostItemPermissionUpdate( +func (h userDriveRestoreHandler) PostItemPermissionUpdate( ctx context.Context, driveID, itemID string, body *drives.ItemItemsItemInvitePostRequestBody, @@ -246,7 +246,7 @@ func (h itemRestoreHandler) PostItemPermissionUpdate( return h.ac.PostItemPermissionUpdate(ctx, driveID, itemID, body) } -func (h itemRestoreHandler) PostItemLinkShareUpdate( +func (h userDriveRestoreHandler) PostItemLinkShareUpdate( ctx context.Context, driveID, itemID string, body *drives.ItemItemsItemCreateLinkPostRequestBody, @@ -254,7 +254,7 @@ func (h itemRestoreHandler) PostItemLinkShareUpdate( return h.ac.PostItemLinkShareUpdate(ctx, driveID, itemID, body) } -func (h itemRestoreHandler) PostItemInContainer( +func (h userDriveRestoreHandler) PostItemInContainer( ctx context.Context, driveID, parentFolderID string, newItem models.DriveItemable, @@ -263,14 +263,14 @@ func (h itemRestoreHandler) PostItemInContainer( return h.ac.PostItemInContainer(ctx, driveID, parentFolderID, newItem, onCollision) } -func (h itemRestoreHandler) GetFolderByName( +func (h userDriveRestoreHandler) GetFolderByName( ctx context.Context, driveID, parentFolderID, folderName string, ) (models.DriveItemable, error) { return h.ac.GetFolderByName(ctx, driveID, parentFolderID, folderName) } -func (h itemRestoreHandler) GetRootFolder( +func (h userDriveRestoreHandler) GetRootFolder( ctx context.Context, driveID string, ) (models.DriveItemable, error) { diff --git a/src/internal/m365/collection/drive/item_handler_test.go b/src/internal/m365/collection/drive/user_drive_handler_test.go similarity index 92% rename from src/internal/m365/collection/drive/item_handler_test.go rename to src/internal/m365/collection/drive/user_drive_handler_test.go index 055cb82acc..b9104ffd7a 100644 --- a/src/internal/m365/collection/drive/item_handler_test.go +++ b/src/internal/m365/collection/drive/user_drive_handler_test.go @@ -36,7 +36,7 @@ func (suite *ItemBackupHandlerUnitSuite) TestPathPrefix() { for _, test := range table { suite.Run(test.name, func() { t := suite.T() - h := itemBackupHandler{userID: resourceOwner} + h := userDriveBackupHandler{userID: resourceOwner} result, err := h.PathPrefix(tenantID, "driveID") test.expectErr(t, err, clues.ToCore(err)) @@ -65,7 +65,7 @@ func (suite *ItemBackupHandlerUnitSuite) TestMetadataPathPrefix() { for _, test := range table { suite.Run(test.name, func() { t := suite.T() - h := itemBackupHandler{userID: resourceOwner} + h := userDriveBackupHandler{userID: resourceOwner} result, err := h.MetadataPathPrefix(tenantID) test.expectErr(t, err, clues.ToCore(err)) @@ -94,7 +94,7 @@ func (suite *ItemBackupHandlerUnitSuite) TestCanonicalPath() { for _, test := range table { suite.Run(test.name, func() { t := suite.T() - h := itemBackupHandler{userID: resourceOwner} + h := userDriveBackupHandler{userID: resourceOwner} p := path.Builder{}.Append("prefix") result, err := h.CanonicalPath(p, tenantID) @@ -110,7 +110,7 @@ func (suite *ItemBackupHandlerUnitSuite) TestCanonicalPath() { func (suite *ItemBackupHandlerUnitSuite) TestServiceCat() { t := suite.T() - s, c := itemBackupHandler{}.ServiceCat() + s, c := userDriveBackupHandler{}.ServiceCat() assert.Equal(t, path.OneDriveService, s) assert.Equal(t, path.FilesCategory, c) } diff --git a/src/internal/m365/collection/site/restore.go b/src/internal/m365/collection/site/restore.go index 20be1aff03..80574db267 100644 --- a/src/internal/m365/collection/site/restore.go +++ b/src/internal/m365/collection/site/restore.go @@ -41,7 +41,7 @@ func ConsumeRestoreCollections( ctr *count.Bus, ) (*support.ControllerOperationStatus, error) { var ( - lrh = drive.NewLibraryRestoreHandler(ac, rcc.Selector.PathService()) + lrh = drive.NewSiteRestoreHandler(ac, rcc.Selector.PathService()) restoreMetrics support.CollectionMetrics caches = drive.NewRestoreCaches(backupDriveIDNames) el = errs.Local() diff --git a/src/internal/m365/restore.go b/src/internal/m365/restore.go index d6237c072f..b7c5f37460 100644 --- a/src/internal/m365/restore.go +++ b/src/internal/m365/restore.go @@ -61,7 +61,7 @@ func (ctrl *Controller) ConsumeRestoreCollections( case path.OneDriveService: status, err = onedrive.ConsumeRestoreCollections( ctx, - drive.NewRestoreHandler(ctrl.AC), + drive.NewUserDriveRestoreHandler(ctrl.AC), rcc, ctrl.backupDriveIDNames, dcs, diff --git a/src/internal/m365/service/groups/restore.go b/src/internal/m365/service/groups/restore.go index fc09088e4a..be99f1c797 100644 --- a/src/internal/m365/service/groups/restore.go +++ b/src/internal/m365/service/groups/restore.go @@ -39,7 +39,7 @@ func ConsumeRestoreCollections( var ( restoreMetrics support.CollectionMetrics caches = drive.NewRestoreCaches(backupDriveIDNames) - lrh = drive.NewLibraryRestoreHandler(ac, rcc.Selector.PathService()) + lrh = drive.NewSiteRestoreHandler(ac, rcc.Selector.PathService()) el = errs.Local() webURLToSiteNames = map[string]string{} ) diff --git a/src/internal/m365/service/onedrive/backup.go b/src/internal/m365/service/onedrive/backup.go index 8d159169ce..e587c30584 100644 --- a/src/internal/m365/service/onedrive/backup.go +++ b/src/internal/m365/service/onedrive/backup.go @@ -49,7 +49,7 @@ func ProduceBackupCollections( logger.Ctx(ctx).Debug("creating OneDrive collections") nc := drive.NewCollections( - drive.NewItemBackupHandler(ac.Drives(), bpc.ProtectedResource.ID(), scope), + drive.NewUserDriveBackupHandler(ac.Drives(), bpc.ProtectedResource.ID(), scope), tenant, bpc.ProtectedResource, su, diff --git a/src/internal/m365/service/sharepoint/backup.go b/src/internal/m365/service/sharepoint/backup.go index c46dc6ef2f..490baffb2b 100644 --- a/src/internal/m365/service/sharepoint/backup.go +++ b/src/internal/m365/service/sharepoint/backup.go @@ -80,7 +80,7 @@ func ProduceBackupCollections( spcs, canUsePreviousBackup, err = site.CollectLibraries( ctx, bpc, - drive.NewLibraryBackupHandler( + drive.NewSiteBackupHandler( ac.Drives(), bpc.ProtectedResource.ID(), scope, diff --git a/src/internal/m365/service/sharepoint/backup_test.go b/src/internal/m365/service/sharepoint/backup_test.go index 6edcfd067c..f1a68bbab5 100644 --- a/src/internal/m365/service/sharepoint/backup_test.go +++ b/src/internal/m365/service/sharepoint/backup_test.go @@ -51,7 +51,7 @@ func (suite *LibrariesBackupUnitSuite) TestUpdateCollections() { ) pb := path.Builder{}.Append(testBaseDrivePath.Elements()...) - ep, err := drive.NewLibraryBackupHandler(api.Drives{}, siteID, nil, path.SharePointService). + ep, err := drive.NewSiteBackupHandler(api.Drives{}, siteID, nil, path.SharePointService). CanonicalPath(pb, tenantID) require.NoError(suite.T(), err, clues.ToCore(err)) @@ -99,7 +99,7 @@ func (suite *LibrariesBackupUnitSuite) TestUpdateCollections() { ) c := drive.NewCollections( - drive.NewLibraryBackupHandler(api.Drives{}, siteID, test.scope, path.SharePointService), + drive.NewSiteBackupHandler(api.Drives{}, siteID, test.scope, path.SharePointService), tenantID, idname.NewProvider(siteID, siteID), nil, diff --git a/src/internal/m365/service/sharepoint/restore.go b/src/internal/m365/service/sharepoint/restore.go index 246b97b69b..e43a07dac9 100644 --- a/src/internal/m365/service/sharepoint/restore.go +++ b/src/internal/m365/service/sharepoint/restore.go @@ -33,7 +33,7 @@ func ConsumeRestoreCollections( ctr *count.Bus, ) (*support.ControllerOperationStatus, error) { var ( - lrh = drive.NewLibraryRestoreHandler(ac, rcc.Selector.PathService()) + lrh = drive.NewSiteRestoreHandler(ac, rcc.Selector.PathService()) restoreMetrics support.CollectionMetrics caches = drive.NewRestoreCaches(backupDriveIDNames) el = errs.Local() diff --git a/src/internal/operations/test/group_test.go b/src/internal/operations/test/group_test.go index 9f60a2274a..f9a40f875e 100644 --- a/src/internal/operations/test/group_test.go +++ b/src/internal/operations/test/group_test.go @@ -62,7 +62,7 @@ func (suite *GroupsBackupIntgSuite) TestBackup_Run_incrementalGroups() { } grh := func(ac api.Client) drive.RestoreHandler { - return drive.NewLibraryRestoreHandler(ac, path.GroupsService) + return drive.NewSiteRestoreHandler(ac, path.GroupsService) } runDriveIncrementalTest( diff --git a/src/internal/operations/test/onedrive_test.go b/src/internal/operations/test/onedrive_test.go index 3343adae81..808c4675c0 100644 --- a/src/internal/operations/test/onedrive_test.go +++ b/src/internal/operations/test/onedrive_test.go @@ -134,7 +134,7 @@ func (suite *OneDriveBackupIntgSuite) TestBackup_Run_incrementalOneDrive() { } grh := func(ac api.Client) drive.RestoreHandler { - return drive.NewRestoreHandler(ac) + return drive.NewUserDriveRestoreHandler(ac) } runDriveIncrementalTest( diff --git a/src/internal/operations/test/sharepoint_test.go b/src/internal/operations/test/sharepoint_test.go index ffe4eb2c34..fa28bb7474 100644 --- a/src/internal/operations/test/sharepoint_test.go +++ b/src/internal/operations/test/sharepoint_test.go @@ -73,7 +73,7 @@ func (suite *SharePointBackupIntgSuite) TestBackup_Run_incrementalSharePoint() { } grh := func(ac api.Client) drive.RestoreHandler { - return drive.NewLibraryRestoreHandler(ac, path.SharePointService) + return drive.NewSiteRestoreHandler(ac, path.SharePointService) } runDriveIncrementalTest(