Now that optiosn are being broken up a bit more passing a struct of a single type to the service handler initializer doesn't make much sense. Just remove the parameter since it was unused anyway. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [x] 🧹 Tech Debt/Cleanup #### Issues - #4896 #### Test Plan - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package m365
|
|
|
|
import (
|
|
"github.com/alcionai/clues"
|
|
|
|
"github.com/alcionai/corso/src/internal/m365/service/exchange"
|
|
"github.com/alcionai/corso/src/internal/m365/service/groups"
|
|
"github.com/alcionai/corso/src/internal/m365/service/onedrive"
|
|
"github.com/alcionai/corso/src/internal/m365/service/sharepoint"
|
|
"github.com/alcionai/corso/src/internal/operations/inject"
|
|
"github.com/alcionai/corso/src/pkg/path"
|
|
)
|
|
|
|
// NewServiceHandler returns an instance of a struct capable of running various
|
|
// operations for a given service.
|
|
func (ctrl *Controller) NewServiceHandler(
|
|
service path.ServiceType,
|
|
) (inject.ServiceHandler, error) {
|
|
ctrl.setResourceHandler(service)
|
|
|
|
switch service {
|
|
case path.OneDriveService:
|
|
return onedrive.NewOneDriveHandler(ctrl.AC, ctrl.resourceHandler), nil
|
|
|
|
case path.SharePointService:
|
|
return sharepoint.NewSharePointHandler(ctrl.AC, ctrl.resourceHandler), nil
|
|
|
|
case path.GroupsService:
|
|
return groups.NewGroupsHandler(ctrl.AC, ctrl.resourceHandler), nil
|
|
|
|
case path.ExchangeService:
|
|
return exchange.NewExchangeHandler(ctrl.AC, ctrl.resourceHandler), nil
|
|
}
|
|
|
|
return nil, clues.New("unrecognized service").
|
|
With("service_type", service.String())
|
|
}
|