remove optionIdentifier (#2001)
## Description the exchange optionIdentifier performs almost all the same functions as the path category. In many cases, it is actually a translation of the other value. This cleanup will cascade into the creation of an api layer for the graph client. ## Does this PR need a docs update or release note? - [x] ⛔ No ## Type of change - [x] 🐹 Trivial/Minor ## Issue(s) * #1967 ## Test Plan - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
7561645fb2
commit
23a3cd6e16
@ -101,7 +101,7 @@ func runDisplayM365JSON(
|
|||||||
|
|
||||||
switch cat {
|
switch cat {
|
||||||
case path.EmailCategory, path.EventsCategory, path.ContactsCategory:
|
case path.EmailCategory, path.EventsCategory, path.ContactsCategory:
|
||||||
get, serializeFunc = exchange.GetQueryAndSerializeFunc(exchange.CategoryToOptionIdentifier(cat))
|
get, serializeFunc = exchange.GetQueryAndSerializeFunc(cat)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unable to process category: %s", cat)
|
return fmt.Errorf("unable to process category: %s", cat)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,9 +59,9 @@ type Collection struct {
|
|||||||
// service - client/adapter pair used to access M365 back store
|
// service - client/adapter pair used to access M365 back store
|
||||||
service graph.Servicer
|
service graph.Servicer
|
||||||
|
|
||||||
collectionType optionIdentifier
|
category path.CategoryType
|
||||||
statusUpdater support.StatusUpdater
|
statusUpdater support.StatusUpdater
|
||||||
ctrl control.Options
|
ctrl control.Options
|
||||||
|
|
||||||
// FullPath is the current hierarchical path used by this collection.
|
// FullPath is the current hierarchical path used by this collection.
|
||||||
fullPath path.Path
|
fullPath path.Path
|
||||||
@ -86,14 +86,14 @@ type Collection struct {
|
|||||||
func NewCollection(
|
func NewCollection(
|
||||||
user string,
|
user string,
|
||||||
curr, prev path.Path,
|
curr, prev path.Path,
|
||||||
collectionType optionIdentifier,
|
category path.CategoryType,
|
||||||
service graph.Servicer,
|
service graph.Servicer,
|
||||||
statusUpdater support.StatusUpdater,
|
statusUpdater support.StatusUpdater,
|
||||||
ctrlOpts control.Options,
|
ctrlOpts control.Options,
|
||||||
doNotMergeItems bool,
|
doNotMergeItems bool,
|
||||||
) Collection {
|
) Collection {
|
||||||
collection := Collection{
|
collection := Collection{
|
||||||
collectionType: collectionType,
|
category: category,
|
||||||
ctrl: ctrlOpts,
|
ctrl: ctrlOpts,
|
||||||
data: make(chan data.Stream, collectionChannelBufferSize),
|
data: make(chan data.Stream, collectionChannelBufferSize),
|
||||||
doNotMergeItems: doNotMergeItems,
|
doNotMergeItems: doNotMergeItems,
|
||||||
@ -135,13 +135,13 @@ func (col *Collection) Items() <-chan data.Stream {
|
|||||||
|
|
||||||
// GetQueryAndSerializeFunc helper function that returns the two functions functions
|
// GetQueryAndSerializeFunc helper function that returns the two functions functions
|
||||||
// required to convert M365 identifier into a byte array filled with the serialized data
|
// required to convert M365 identifier into a byte array filled with the serialized data
|
||||||
func GetQueryAndSerializeFunc(optID optionIdentifier) (GraphRetrievalFunc, GraphSerializeFunc) {
|
func GetQueryAndSerializeFunc(category path.CategoryType) (GraphRetrievalFunc, GraphSerializeFunc) {
|
||||||
switch optID {
|
switch category {
|
||||||
case contacts:
|
case path.ContactsCategory:
|
||||||
return RetrieveContactDataForUser, serializeAndStreamContact
|
return RetrieveContactDataForUser, serializeAndStreamContact
|
||||||
case events:
|
case path.EventsCategory:
|
||||||
return RetrieveEventDataForUser, serializeAndStreamEvent
|
return RetrieveEventDataForUser, serializeAndStreamEvent
|
||||||
case messages:
|
case path.EmailCategory:
|
||||||
return RetrieveMessageDataForUser, serializeAndStreamMessage
|
return RetrieveMessageDataForUser, serializeAndStreamMessage
|
||||||
// Unsupported options returns nil, nil
|
// Unsupported options returns nil, nil
|
||||||
default:
|
default:
|
||||||
@ -195,9 +195,9 @@ func (col *Collection) streamItems(ctx context.Context) {
|
|||||||
// get QueryBasedonIdentifier
|
// get QueryBasedonIdentifier
|
||||||
// verify that it is the correct type in called function
|
// verify that it is the correct type in called function
|
||||||
// serializationFunction
|
// serializationFunction
|
||||||
query, serializeFunc := GetQueryAndSerializeFunc(col.collectionType)
|
query, serializeFunc := GetQueryAndSerializeFunc(col.category)
|
||||||
if query == nil {
|
if query == nil {
|
||||||
errs = fmt.Errorf("unrecognized collection type: %s", col.collectionType.String())
|
errs = fmt.Errorf("unrecognized collection type: %s", col.category)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,29 +0,0 @@
|
|||||||
// Code generated by "stringer -type=optionIdentifier"; DO NOT EDIT.
|
|
||||||
|
|
||||||
package exchange
|
|
||||||
|
|
||||||
import "strconv"
|
|
||||||
|
|
||||||
func _() {
|
|
||||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
|
||||||
// Re-run the stringer command to generate them again.
|
|
||||||
var x [1]struct{}
|
|
||||||
_ = x[unknown-0]
|
|
||||||
_ = x[folders-1]
|
|
||||||
_ = x[calendars-2]
|
|
||||||
_ = x[events-3]
|
|
||||||
_ = x[messages-4]
|
|
||||||
_ = x[users-5]
|
|
||||||
_ = x[contacts-6]
|
|
||||||
}
|
|
||||||
|
|
||||||
const _optionIdentifier_name = "unknownfolderscalendarseventsmessagesuserscontacts"
|
|
||||||
|
|
||||||
var _optionIdentifier_index = [...]uint8{0, 7, 14, 23, 29, 37, 42, 50}
|
|
||||||
|
|
||||||
func (i optionIdentifier) String() string {
|
|
||||||
if i < 0 || i >= optionIdentifier(len(_optionIdentifier_index)-1) {
|
|
||||||
return "optionIdentifier(" + strconv.FormatInt(int64(i), 10) + ")"
|
|
||||||
}
|
|
||||||
return _optionIdentifier_name[_optionIdentifier_index[i]:_optionIdentifier_index[i+1]]
|
|
||||||
}
|
|
||||||
@ -4,9 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
msuser "github.com/microsoftgraph/msgraph-sdk-go/users"
|
msuser "github.com/microsoftgraph/msgraph-sdk-go/users"
|
||||||
"github.com/pkg/errors"
|
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/pkg/path"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@ -15,98 +12,59 @@ import (
|
|||||||
// selectors for M365 objects
|
// selectors for M365 objects
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
var (
|
var (
|
||||||
fieldsForCalendars = map[string]int{
|
fieldsForCalendars = map[string]struct{}{
|
||||||
"changeKey": 1,
|
"changeKey": {},
|
||||||
"events": 2,
|
"events": {},
|
||||||
"id": 3,
|
"id": {},
|
||||||
"isDefaultCalendar": 4,
|
"isDefaultCalendar": {},
|
||||||
"name": 5,
|
"name": {},
|
||||||
"owner": 6,
|
"owner": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsForEvents = map[string]int{
|
fieldsForEvents = map[string]struct{}{
|
||||||
"calendar": 1,
|
"calendar": {},
|
||||||
"end": 2,
|
"end": {},
|
||||||
"id": 3,
|
"id": {},
|
||||||
"isOnlineMeeting": 4,
|
"isOnlineMeeting": {},
|
||||||
"isReminderOn": 5,
|
"isReminderOn": {},
|
||||||
"responseStatus": 6,
|
"responseStatus": {},
|
||||||
"responseRequested": 7,
|
"responseRequested": {},
|
||||||
"showAs": 8,
|
"showAs": {},
|
||||||
"subject": 9,
|
"subject": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsForFolders = map[string]int{
|
fieldsForFolders = map[string]struct{}{
|
||||||
"childFolderCount": 1,
|
"childFolderCount": {},
|
||||||
"displayName": 2,
|
"displayName": {},
|
||||||
"id": 3,
|
"id": {},
|
||||||
"isHidden": 4,
|
"isHidden": {},
|
||||||
"parentFolderId": 5,
|
"parentFolderId": {},
|
||||||
"totalItemCount": 6,
|
"totalItemCount": {},
|
||||||
"unreadItemCount": 7,
|
"unreadItemCount": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsForUsers = map[string]int{
|
fieldsForMessages = map[string]struct{}{
|
||||||
"birthday": 1,
|
"conservationId": {},
|
||||||
"businessPhones": 2,
|
"conversationIndex": {},
|
||||||
"city": 3,
|
"parentFolderId": {},
|
||||||
"companyName": 4,
|
"subject": {},
|
||||||
"department": 5,
|
"webLink": {},
|
||||||
"displayName": 6,
|
"id": {},
|
||||||
"employeeId": 7,
|
"isRead": {},
|
||||||
"id": 8,
|
|
||||||
"mail": 9,
|
|
||||||
"userPrincipalName": 10,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsForMessages = map[string]int{
|
fieldsForContacts = map[string]struct{}{
|
||||||
"conservationId": 1,
|
"id": {},
|
||||||
"conversationIndex": 2,
|
"companyName": {},
|
||||||
"parentFolderId": 3,
|
"department": {},
|
||||||
"subject": 4,
|
"displayName": {},
|
||||||
"webLink": 5,
|
"fileAs": {},
|
||||||
"id": 6,
|
"givenName": {},
|
||||||
"isRead": 7,
|
"manager": {},
|
||||||
}
|
"parentFolderId": {},
|
||||||
|
|
||||||
fieldsForContacts = map[string]int{
|
|
||||||
"id": 1,
|
|
||||||
"companyName": 2,
|
|
||||||
"department": 3,
|
|
||||||
"displayName": 4,
|
|
||||||
"fileAs": 5,
|
|
||||||
"givenName": 6,
|
|
||||||
"manager": 7,
|
|
||||||
"parentFolderId": 8,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
type optionIdentifier int
|
|
||||||
|
|
||||||
//go:generate stringer -type=optionIdentifier
|
|
||||||
const (
|
|
||||||
unknown optionIdentifier = iota
|
|
||||||
folders
|
|
||||||
calendars
|
|
||||||
events
|
|
||||||
messages
|
|
||||||
users
|
|
||||||
contacts
|
|
||||||
)
|
|
||||||
|
|
||||||
func CategoryToOptionIdentifier(category path.CategoryType) optionIdentifier {
|
|
||||||
switch category {
|
|
||||||
case path.EmailCategory:
|
|
||||||
return messages
|
|
||||||
case path.ContactsCategory:
|
|
||||||
return contacts
|
|
||||||
case path.EventsCategory:
|
|
||||||
return events
|
|
||||||
default:
|
|
||||||
return unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// exchange.Query Option Section
|
// exchange.Query Option Section
|
||||||
// These functions can be used to filter a response on M365
|
// These functions can be used to filter a response on M365
|
||||||
@ -117,7 +75,7 @@ func CategoryToOptionIdentifier(category path.CategoryType) optionIdentifier {
|
|||||||
func optionsForFolderMessagesDelta(
|
func optionsForFolderMessagesDelta(
|
||||||
moreOps []string,
|
moreOps []string,
|
||||||
) (*msuser.ItemMailFoldersItemMessagesDeltaRequestBuilderGetRequestConfiguration, error) {
|
) (*msuser.ItemMailFoldersItemMessagesDeltaRequestBuilderGetRequestConfiguration, error) {
|
||||||
selecting, err := buildOptions(moreOps, messages)
|
selecting, err := buildOptions(moreOps, fieldsForMessages)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -139,7 +97,7 @@ func optionsForCalendars(moreOps []string) (
|
|||||||
*msuser.ItemCalendarsRequestBuilderGetRequestConfiguration,
|
*msuser.ItemCalendarsRequestBuilderGetRequestConfiguration,
|
||||||
error,
|
error,
|
||||||
) {
|
) {
|
||||||
selecting, err := buildOptions(moreOps, calendars)
|
selecting, err := buildOptions(moreOps, fieldsForCalendars)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -160,7 +118,7 @@ func optionsForContactFolders(moreOps []string) (
|
|||||||
*msuser.ItemContactFoldersRequestBuilderGetRequestConfiguration,
|
*msuser.ItemContactFoldersRequestBuilderGetRequestConfiguration,
|
||||||
error,
|
error,
|
||||||
) {
|
) {
|
||||||
selecting, err := buildOptions(moreOps, folders)
|
selecting, err := buildOptions(moreOps, fieldsForFolders)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -179,7 +137,7 @@ func optionsForContactFolderByID(moreOps []string) (
|
|||||||
*msuser.ItemContactFoldersContactFolderItemRequestBuilderGetRequestConfiguration,
|
*msuser.ItemContactFoldersContactFolderItemRequestBuilderGetRequestConfiguration,
|
||||||
error,
|
error,
|
||||||
) {
|
) {
|
||||||
selecting, err := buildOptions(moreOps, folders)
|
selecting, err := buildOptions(moreOps, fieldsForFolders)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -200,7 +158,7 @@ func optionsForContactFolderByID(moreOps []string) (
|
|||||||
func optionsForMailFolders(
|
func optionsForMailFolders(
|
||||||
moreOps []string,
|
moreOps []string,
|
||||||
) (*msuser.ItemMailFoldersRequestBuilderGetRequestConfiguration, error) {
|
) (*msuser.ItemMailFoldersRequestBuilderGetRequestConfiguration, error) {
|
||||||
selecting, err := buildOptions(moreOps, folders)
|
selecting, err := buildOptions(moreOps, fieldsForFolders)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -221,7 +179,7 @@ func optionsForMailFolders(
|
|||||||
func optionsForMailFoldersItem(
|
func optionsForMailFoldersItem(
|
||||||
moreOps []string,
|
moreOps []string,
|
||||||
) (*msuser.ItemMailFoldersMailFolderItemRequestBuilderGetRequestConfiguration, error) {
|
) (*msuser.ItemMailFoldersMailFolderItemRequestBuilderGetRequestConfiguration, error) {
|
||||||
selecting, err := buildOptions(moreOps, folders)
|
selecting, err := buildOptions(moreOps, fieldsForFolders)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -239,7 +197,7 @@ func optionsForMailFoldersItem(
|
|||||||
func optionsForContactFoldersItemDelta(
|
func optionsForContactFoldersItemDelta(
|
||||||
moreOps []string,
|
moreOps []string,
|
||||||
) (*msuser.ItemContactFoldersItemContactsDeltaRequestBuilderGetRequestConfiguration, error) {
|
) (*msuser.ItemContactFoldersItemContactsDeltaRequestBuilderGetRequestConfiguration, error) {
|
||||||
selecting, err := buildOptions(moreOps, contacts)
|
selecting, err := buildOptions(moreOps, fieldsForContacts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -258,7 +216,7 @@ func optionsForContactFoldersItemDelta(
|
|||||||
// optionsForEvents ensures valid option inputs for exchange.Events
|
// optionsForEvents ensures valid option inputs for exchange.Events
|
||||||
// @return is first call in Events().GetWithRequestConfigurationAndResponseHandler(options, handler)
|
// @return is first call in Events().GetWithRequestConfigurationAndResponseHandler(options, handler)
|
||||||
func optionsForEvents(moreOps []string) (*msuser.ItemEventsRequestBuilderGetRequestConfiguration, error) {
|
func optionsForEvents(moreOps []string) (*msuser.ItemEventsRequestBuilderGetRequestConfiguration, error) {
|
||||||
selecting, err := buildOptions(moreOps, events)
|
selecting, err := buildOptions(moreOps, fieldsForEvents)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -277,7 +235,7 @@ func optionsForEvents(moreOps []string) (*msuser.ItemEventsRequestBuilderGetRequ
|
|||||||
func optionsForEventsByCalendar(
|
func optionsForEventsByCalendar(
|
||||||
moreOps []string,
|
moreOps []string,
|
||||||
) (*msuser.ItemCalendarsItemEventsRequestBuilderGetRequestConfiguration, error) {
|
) (*msuser.ItemCalendarsItemEventsRequestBuilderGetRequestConfiguration, error) {
|
||||||
selecting, err := buildOptions(moreOps, events)
|
selecting, err := buildOptions(moreOps, fieldsForEvents)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -297,7 +255,7 @@ func optionsForEventsByCalendar(
|
|||||||
func optionsForContactChildFolders(
|
func optionsForContactChildFolders(
|
||||||
moreOps []string,
|
moreOps []string,
|
||||||
) (*msuser.ItemContactFoldersItemChildFoldersRequestBuilderGetRequestConfiguration, error) {
|
) (*msuser.ItemContactFoldersItemChildFoldersRequestBuilderGetRequestConfiguration, error) {
|
||||||
selecting, err := buildOptions(moreOps, contacts)
|
selecting, err := buildOptions(moreOps, fieldsForContacts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -315,7 +273,7 @@ func optionsForContactChildFolders(
|
|||||||
// optionsForContacts transforms options into select query for MailContacts
|
// optionsForContacts transforms options into select query for MailContacts
|
||||||
// @return is the first call in Contacts().GetWithRequestConfigurationAndResponseHandler(options, handler)
|
// @return is the first call in Contacts().GetWithRequestConfigurationAndResponseHandler(options, handler)
|
||||||
func optionsForContacts(moreOps []string) (*msuser.ItemContactsRequestBuilderGetRequestConfiguration, error) {
|
func optionsForContacts(moreOps []string) (*msuser.ItemContactsRequestBuilderGetRequestConfiguration, error) {
|
||||||
selecting, err := buildOptions(moreOps, contacts)
|
selecting, err := buildOptions(moreOps, fieldsForContacts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -333,39 +291,15 @@ func optionsForContacts(moreOps []string) (*msuser.ItemContactsRequestBuilderGet
|
|||||||
// buildOptions - Utility Method for verifying if select options are valid for the m365 object type
|
// buildOptions - Utility Method for verifying if select options are valid for the m365 object type
|
||||||
// @return is a pair. The first is a string literal of allowable options based on the object type,
|
// @return is a pair. The first is a string literal of allowable options based on the object type,
|
||||||
// the second is an error. An error is returned if an unsupported option or optionIdentifier was used
|
// the second is an error. An error is returned if an unsupported option or optionIdentifier was used
|
||||||
func buildOptions(options []string, optID optionIdentifier) ([]string, error) {
|
func buildOptions(fields []string, allowed map[string]struct{}) ([]string, error) {
|
||||||
var (
|
returnedOptions := []string{"id"}
|
||||||
allowedOptions map[string]int
|
|
||||||
returnedOptions = []string{"id"}
|
|
||||||
)
|
|
||||||
|
|
||||||
switch optID {
|
for _, entry := range fields {
|
||||||
case calendars:
|
_, ok := allowed[entry]
|
||||||
allowedOptions = fieldsForCalendars
|
|
||||||
case contacts:
|
|
||||||
allowedOptions = fieldsForContacts
|
|
||||||
case events:
|
|
||||||
allowedOptions = fieldsForEvents
|
|
||||||
case folders:
|
|
||||||
allowedOptions = fieldsForFolders
|
|
||||||
case users:
|
|
||||||
allowedOptions = fieldsForUsers
|
|
||||||
case messages:
|
|
||||||
allowedOptions = fieldsForMessages
|
|
||||||
case unknown:
|
|
||||||
fallthrough
|
|
||||||
default:
|
|
||||||
return nil, errors.New("unsupported option")
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, entry := range options {
|
|
||||||
_, ok := allowedOptions[entry]
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("unsupported element passed to buildOptions: %v", entry)
|
return nil, fmt.Errorf("unsupported field: %v", entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
returnedOptions = append(returnedOptions, entry)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnedOptions, nil
|
return append(returnedOptions, fields...), nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,6 @@ func filterContainersAndFillCollections(
|
|||||||
) error {
|
) error {
|
||||||
var (
|
var (
|
||||||
errs error
|
errs error
|
||||||
oi = CategoryToOptionIdentifier(qp.Category)
|
|
||||||
// folder ID -> delta url or folder path lookups
|
// folder ID -> delta url or folder path lookups
|
||||||
deltaURLs = map[string]string{}
|
deltaURLs = map[string]string{}
|
||||||
currPaths = map[string]string{}
|
currPaths = map[string]string{}
|
||||||
@ -119,7 +118,7 @@ func filterContainersAndFillCollections(
|
|||||||
qp.ResourceOwner,
|
qp.ResourceOwner,
|
||||||
currPath,
|
currPath,
|
||||||
prevPath,
|
prevPath,
|
||||||
oi,
|
scope.Category().PathType(),
|
||||||
service,
|
service,
|
||||||
statusUpdater,
|
statusUpdater,
|
||||||
ctrlOpts,
|
ctrlOpts,
|
||||||
@ -169,7 +168,7 @@ func filterContainersAndFillCollections(
|
|||||||
qp.ResourceOwner,
|
qp.ResourceOwner,
|
||||||
nil, // marks the collection as deleted
|
nil, // marks the collection as deleted
|
||||||
prevPath,
|
prevPath,
|
||||||
oi,
|
scope.Category().PathType(),
|
||||||
service,
|
service,
|
||||||
statusUpdater,
|
statusUpdater,
|
||||||
ctrlOpts,
|
ctrlOpts,
|
||||||
|
|||||||
@ -37,14 +37,12 @@ func RestoreExchangeObject(
|
|||||||
return nil, fmt.Errorf("restore policy: %s not supported for RestoreExchangeObject", policy)
|
return nil, fmt.Errorf("restore policy: %s not supported for RestoreExchangeObject", policy)
|
||||||
}
|
}
|
||||||
|
|
||||||
setting := CategoryToOptionIdentifier(category)
|
switch category {
|
||||||
|
case path.EmailCategory:
|
||||||
switch setting {
|
|
||||||
case messages:
|
|
||||||
return RestoreMailMessage(ctx, bits, service, control.Copy, destination, user)
|
return RestoreMailMessage(ctx, bits, service, control.Copy, destination, user)
|
||||||
case contacts:
|
case path.ContactsCategory:
|
||||||
return RestoreExchangeContact(ctx, bits, service, control.Copy, destination, user)
|
return RestoreExchangeContact(ctx, bits, service, control.Copy, destination, user)
|
||||||
case events:
|
case path.EventsCategory:
|
||||||
return RestoreExchangeEvent(ctx, bits, service, control.Copy, destination, user)
|
return RestoreExchangeEvent(ctx, bits, service, control.Copy, destination, user)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("type: %s not supported for RestoreExchangeObject", category)
|
return nil, fmt.Errorf("type: %s not supported for RestoreExchangeObject", category)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user