onboarding

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package onboarding coordinates tenant creation with plan, subscription, feature, quota, audit, and notification setup.

Index

Constants

This section is empty.

Variables

View Source
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

func WithAuditStore(store audit.Store) Option

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

func WithQuotaStore(store saasquota.Store) Option

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

func (service *Service) Onboard(ctx context.Context, input Input) (Result, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL