/
handlers.go
85 lines (72 loc) · 1.91 KB
/
handlers.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
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"
)
type backupHandler interface {
getItemByIDer
getItemser
canonicalPather
}
// canonicalPath constructs the service and category specific path for
// the given builder.
type canonicalPather interface {
CanonicalPath(
storageDir path.Elements,
tenantID string,
) (path.Path, error)
}
type getItemByIDer interface {
GetItemByID(ctx context.Context, itemID string) (models.Listable, *details.SharePointInfo, error)
}
type getItemser interface {
GetItems(ctx context.Context, cc api.CallConfig) ([]models.Listable, error)
}
type restoreHandler interface {
PostLister
PatchLister
DeleteLister
GetLister
GetListsByCollisionKeyser
}
type PostLister interface {
PostList(
ctx context.Context,
listName string,
storedList models.Listable,
errs *fault.Bus,
) (models.Listable, error)
}
type PatchLister interface {
PatchList(
ctx context.Context,
listID string,
list models.Listable,
) (models.Listable, error)
}
type DeleteLister interface {
DeleteList(
ctx context.Context,
listID string,
) error
}
type GetLister interface {
GetList(
ctx context.Context,
listID string,
) (models.Listable, *details.SharePointInfo, error)
}
type GetListsByCollisionKeyser interface {
// GetListsByCollisionKey looks up all lists currently in
// the site, and returns them in a map[collisionKey]listID.
// The collision key is displayName of the list
// which uniquely identifies the list.
// Collision key checks are used during restore to handle the on-
// collision restore configurations that cause the list restore to get
// skipped, replaced, or copied.
GetListsByCollisionKey(ctx context.Context) (map[string]string, error)
}