-
Notifications
You must be signed in to change notification settings - Fork 23
/
lists_handler.go
100 lines (83 loc) · 2.47 KB
/
lists_handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package site
import (
"context"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/alcionai/corso/src/pkg/backup/details"
"github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/path"
"github.com/alcionai/corso/src/pkg/services/m365/api"
)
var _ backupHandler = &listsBackupHandler{}
type listsBackupHandler struct {
ac api.Lists
protectedResource string
}
func NewListsBackupHandler(protectedResource string, ac api.Lists) listsBackupHandler {
return listsBackupHandler{
ac: ac,
protectedResource: protectedResource,
}
}
func (bh listsBackupHandler) CanonicalPath(
storageDirFolders path.Elements,
tenantID string,
) (path.Path, error) {
return storageDirFolders.
Builder().
ToDataLayerPath(
tenantID,
bh.protectedResource,
path.SharePointService,
path.ListsCategory,
false)
}
func (bh listsBackupHandler) GetItemByID(
ctx context.Context,
itemID string,
) (models.Listable, *details.SharePointInfo, error) {
return bh.ac.GetListByID(ctx, bh.protectedResource, itemID)
}
func (bh listsBackupHandler) GetItems(ctx context.Context, cc api.CallConfig) ([]models.Listable, error) {
return bh.ac.GetLists(ctx, bh.protectedResource, cc)
}
var _ restoreHandler = &listsRestoreHandler{}
type listsRestoreHandler struct {
ac api.Lists
protectedResource string
}
func NewListsRestoreHandler(protectedResource string, ac api.Lists) listsRestoreHandler {
return listsRestoreHandler{
ac: ac,
protectedResource: protectedResource,
}
}
func (rh listsRestoreHandler) PostList(
ctx context.Context,
listName string,
storedList models.Listable,
errs *fault.Bus,
) (models.Listable, error) {
return rh.ac.PostList(ctx, rh.protectedResource, listName, storedList, errs)
}
func (rh listsRestoreHandler) PatchList(
ctx context.Context,
listID string,
list models.Listable,
) (models.Listable, error) {
return rh.ac.PatchList(ctx, rh.protectedResource, listID, list)
}
func (rh listsRestoreHandler) DeleteList(
ctx context.Context,
listID string,
) error {
return rh.ac.DeleteList(ctx, rh.protectedResource, listID)
}
func (rh listsRestoreHandler) GetList(
ctx context.Context,
listID string,
) (models.Listable, *details.SharePointInfo, error) {
return rh.ac.GetListByID(ctx, rh.protectedResource, listID)
}
func (rh listsRestoreHandler) GetListsByCollisionKey(ctx context.Context) (map[string]string, error) {
return rh.ac.GetListsByCollisionKey(ctx, rh.protectedResource)
}