Documentation
¶
Overview ¶
Package onboarding coordinates tenant creation with plan, subscription, feature, quota, audit, and notification setup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidInput reports missing required onboarding dependencies or input fields. ErrInvalidInput = errors.New("gotenancy/onboarding: invalid input") )
Functions ¶
This section is empty.
Types ¶
type Input ¶
type Input struct {
Tenant saastenant.CreateInput
SubscriptionPeriodEnd *time.Time
FeatureOverrides []saasfeature.Flag
Welcome *notification.Message
SkipActivation bool
AuditMetadata map[string]string
}
Input describes a tenant onboarding request.
type Option ¶
type Option func(*Service)
Option configures onboarding integrations.
func WithAuditStore ¶
WithAuditStore records a tenant.onboard event after the flow succeeds.
func WithFeatureStore ¶
func WithFeatureStore(store saasfeature.Store) Option
WithFeatureStore initializes plan defaults and tenant feature overrides.
func WithNotifier ¶
func WithNotifier(notifier notification.Notifier) Option
WithNotifier sends an optional welcome message after the flow succeeds.
func WithQuotaStore ¶
WithQuotaStore initializes tenant quota usage buckets from the selected plan.
type Result ¶
type Result struct {
Tenant types.Tenant
Plan saasplan.Plan
Subscription saassubscription.Subscription
Features []saasfeature.Flag
QuotaLimits []saasquota.Limit
}
Result describes the completed onboarding state.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates the default tenant onboarding flow.
func New ¶
func New(tenants saastenant.Service, plans saasplan.Service, subscriptions saassubscription.Service, opts ...Option) *Service
New creates an onboarding service.
func (*Service) Onboard ¶
Onboard creates the tenant, attaches the selected plan subscription, initializes feature and quota state, records audit metadata, optionally sends a welcome message, and activates the tenant unless SkipActivation is set. Errors after tenant creation return the completed portion of Result. Callers that omit a tenant ID should reuse Result.Tenant.ID when retrying a partially completed flow. Welcome Message.ID is stable and the in-process service suppresses repeats; restart and multi-process idempotency require the Notifier to honor Message.ID as its delivery idempotency key.