corso/src/pkg/account/account.go
ashmrtn 395c7c8525
Add spell check linter and run gofmt in golangci-lint (#396)
* Basic golangci-lint config with gofmt and timeout

Remove corresponding sections from other CI config files.

* Enable comment and string spelling linter

* Fix spelling mistakes for linter

Co-authored-by: Danny <danny@alcion.ai>
2022-07-22 18:28:25 +00:00

37 lines
894 B
Go

package account
import (
"errors"
"github.com/alcionai/corso/internal/common"
)
type accountProvider int
//go:generate stringer -type=accountProvider -linecomment
const (
ProviderUnknown accountProvider = iota // Unknown Provider
ProviderM365 // M365
)
// storage parsing errors
var (
errMissingRequired = errors.New("missing required storage configuration")
)
// Account defines an account provider, along with any credentials
// and identifiers required to set up or communicate with that provider.
type Account struct {
Provider accountProvider
Config map[string]string
}
// NewAccount aggregates all the supplied configurations into a single configuration
func NewAccount(p accountProvider, cfgs ...common.StringConfigurer) (Account, error) {
cs, err := common.UnionStringConfigs(cfgs...)
return Account{
Provider: p,
Config: cs,
}, err
}