Documentation
¶
Index ¶
- func Apply(cs *Changeset, fo Applier, desired *DesiredState, cfg CallerNameResolver) []error
- func PrintChangeset(cs *Changeset, w io.Writer)
- type Applier
- type CallerImageSet
- type CallerNameResolver
- type CallerNameSet
- type Changeset
- type DepartmentState
- type DesiredState
- type FakeApplier
- func (f *FakeApplier) CreateBusinessUnit(name string) (*firstorion.BusinessUnit, error)
- func (f *FakeApplier) CreateProgram(buID, name, callPurposeCode string, dailyRangeID int, auth bool) (*firstorion.Program, error)
- func (f *FakeApplier) DeleteBusinessUnit(buID string) error
- func (f *FakeApplier) DeleteProgram(buID, progID string) error
- func (f *FakeApplier) DeregisterPhoneNumbers(numbers []string) error
- func (f *FakeApplier) EnsureDisplayNameAsset(long, short string) (string, error)
- func (f *FakeApplier) EnsureSchedule(buID, programID string) error
- func (f *FakeApplier) EnsureSubjectAsset(subject string) (string, error)
- func (f *FakeApplier) RegisterPhoneNumbers(numbers []string, buID, progID, cpc string, auth bool) error
- func (f *FakeApplier) SetCallerImage(buID, progID, dn, img, sub string) error
- func (f *FakeApplier) SetCallerName(buID, progID, long, short string) error
- func (f *FakeApplier) UpdatePhoneNumbers(reqs []firstorion.UpdatePhoneNumberRequest) error
- type PhoneNumberMove
- type ProgramCreate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(cs *Changeset, fo Applier, desired *DesiredState, cfg CallerNameResolver) []error
Apply executes the changeset against FO. Returns accumulated errors (fail-slow).
func PrintChangeset ¶
PrintChangeset writes a human-readable summary of planned changes to w.
Types ¶
type Applier ¶
type Applier interface {
CreateBusinessUnit(name string) (*firstorion.BusinessUnit, error)
DeleteBusinessUnit(buID string) error
CreateProgram(buID, name, callPurposeCode string, dailyRangeID int, authenticatedCalls bool) (*firstorion.Program, error)
DeleteProgram(buID, programID string) error
SetCallerName(buID, programID, longName, shortName string) error
SetCallerImage(buID, programID, displayNameContentID, imageContentID, subjectContentID string) error
EnsureDisplayNameAsset(longName, shortName string) (string, error)
EnsureSubjectAsset(subject string) (string, error)
EnsureSchedule(buID, programID string) error
RegisterPhoneNumbers(numbers []string, buID, programID, callPurposeCode string, authenticatedCalls bool) error
UpdatePhoneNumbers(reqs []firstorion.UpdatePhoneNumberRequest) error
DeregisterPhoneNumbers(numbers []string) error
}
Applier is the interface Apply uses to write to First Orion.
type CallerImageSet ¶
type CallerImageSet struct {
DepartmentName string
BuID string
ProgramID string
DisplayNameContentID string // long name string — passed to EnsureDisplayNameAsset if ConfiguredDisplayNameID is empty
DisplayNameShortName string
ConfiguredDisplayNameID string // pre-approved FO contentId; skips EnsureDisplayNameAsset when set
ImageContentID string
SubjectContentID string // pre-approved FO contentId; skips EnsureSubjectAsset when set
SubjectText string // sanitized subject text used by EnsureSubjectAsset when SubjectContentID is empty
}
type CallerNameResolver ¶
type CallerNameResolver interface {
CallerNames(dept string, warn func(string)) (longName, shortName string)
ImageContentID(dept string) string
DisplayNameContentID(dept string) string
BrandDisplayName() string
SubjectContentID(dept string) string
SanitizedSubjectText(dept string) string
CallPurposeCode() string
DailyCallCountEstimateRangeID() int
AuthenticatedCalls() bool
}
CallerNameResolver provides longName/shortName and FO config for a department.
type CallerNameSet ¶
type Changeset ¶
type Changeset struct {
BusinessUnitsToCreate []string
BusinessUnitsToDelete []firstorion.BusinessUnit
ProgramsToCreate []string
ProgramsToDelete []firstorion.Program
CallerNamesToSet []CallerNameSet
CallerImagesToSet []CallerImageSet
NumbersToRegister []string
NumbersToMove []PhoneNumberMove
NumbersToDeregister []string
// Pre-populated from actual FO state so Apply can find IDs for existing entities.
ExistingBUIDs map[string]string // dept name → BU ID
ExistingProgIDs map[string]string // dept name → Program ID
}
func Diff ¶
func Diff(desired *DesiredState, actual *firstorion.ActualState) *Changeset
type DepartmentState ¶
type DesiredState ¶
type DesiredState struct {
Departments []DepartmentState
}
func BuildDesired ¶
func BuildDesired(users []zoom.User, fallbackDept string) *DesiredState
type FakeApplier ¶
type FakeApplier struct {
CreateBUFn func(name string) (*firstorion.BusinessUnit, error)
DeleteBUFn func(buID string) error
CreateProgramFn func(buID, name, callPurposeCode string, dailyRangeID int, authenticatedCalls bool) (*firstorion.Program, error)
DeleteProgramFn func(buID, programID string) error
SetCallerNameFn func(buID, programID, longName, shortName string) error
SetCallerImageFn func(buID, programID, displayNameContentID, imageContentID, subjectContentID string) error
EnsureDisplayNameFn func(longName, shortName string) (string, error)
EnsureSubjectFn func(subject string) (string, error)
EnsureScheduleFn func(buID, programID string) error
RegisterPhoneNumbersFn func(numbers []string, buID, programID, callPurposeCode string, authenticatedCalls bool) error
UpdatePhoneNumbersFn func(reqs []firstorion.UpdatePhoneNumberRequest) error
DeregisterFn func(numbers []string) error
}
FakeApplier is a test double for Applier.
func (*FakeApplier) CreateBusinessUnit ¶
func (f *FakeApplier) CreateBusinessUnit(name string) (*firstorion.BusinessUnit, error)
func (*FakeApplier) CreateProgram ¶
func (f *FakeApplier) CreateProgram(buID, name, callPurposeCode string, dailyRangeID int, auth bool) (*firstorion.Program, error)
func (*FakeApplier) DeleteBusinessUnit ¶
func (f *FakeApplier) DeleteBusinessUnit(buID string) error
func (*FakeApplier) DeleteProgram ¶
func (f *FakeApplier) DeleteProgram(buID, progID string) error
func (*FakeApplier) DeregisterPhoneNumbers ¶
func (f *FakeApplier) DeregisterPhoneNumbers(numbers []string) error
func (*FakeApplier) EnsureDisplayNameAsset ¶
func (f *FakeApplier) EnsureDisplayNameAsset(long, short string) (string, error)
func (*FakeApplier) EnsureSchedule ¶
func (f *FakeApplier) EnsureSchedule(buID, programID string) error
func (*FakeApplier) EnsureSubjectAsset ¶
func (f *FakeApplier) EnsureSubjectAsset(subject string) (string, error)
func (*FakeApplier) RegisterPhoneNumbers ¶
func (f *FakeApplier) RegisterPhoneNumbers(numbers []string, buID, progID, cpc string, auth bool) error
func (*FakeApplier) SetCallerImage ¶
func (f *FakeApplier) SetCallerImage(buID, progID, dn, img, sub string) error
func (*FakeApplier) SetCallerName ¶
func (f *FakeApplier) SetCallerName(buID, progID, long, short string) error
func (*FakeApplier) UpdatePhoneNumbers ¶
func (f *FakeApplier) UpdatePhoneNumbers(reqs []firstorion.UpdatePhoneNumberRequest) error
type PhoneNumberMove ¶
type ProgramCreate ¶
Click to show internal directories.
Click to hide internal directories.