Documentation
¶
Overview ¶
Package teamcosts provides team cost allocation capabilities for TokMan
Index ¶
- type Allocation
- type AllocationPeriod
- type AllocationRule
- type Allocator
- func (a *Allocator) AddAllocationRule(rule AllocationRule) error
- func (a *Allocator) AddMember(teamID, userID string) error
- func (a *Allocator) AllocateCost(teamID string, amount float64, source CostSource, description string, ...) (*Allocation, error)
- func (a *Allocator) ApplyAllocationRules(source CostSource, amount float64, tags map[string]string) ([]*Allocation, error)
- func (a *Allocator) CreateTeam(name, description string, budget Budget) (*Team, error)
- func (a *Allocator) DeleteTeam(id string) error
- func (a *Allocator) GenerateReport(period AllocationPeriod) *Report
- func (a *Allocator) GetTeam(id string) (*Team, error)
- func (a *Allocator) GetTeamCosts(teamID string) (*CostSummary, error)
- func (a *Allocator) ListTeams() []*Team
- func (a *Allocator) RemoveMember(teamID, userID string) error
- func (a *Allocator) SetBudget(teamID string, budget Budget) error
- func (a *Allocator) UpdateTeam(id string, updates TeamUpdates) error
- type Budget
- type CostBreakdown
- type CostItem
- type CostSource
- type CostSummary
- type Report
- type ReportSummary
- type RuleAllocation
- type RuleCondition
- type Team
- type TeamReport
- type TeamUpdates
- type Trends
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocation ¶
type Allocation struct {
ID string
TeamID string
Amount float64
Currency string
Period AllocationPeriod
Source CostSource
Description string
Tags map[string]string
CreatedAt time.Time
}
Allocation represents a cost allocation entry
type AllocationPeriod ¶
AllocationPeriod defines the time period
type AllocationRule ¶
type AllocationRule struct {
ID string
Name string
Priority int
Condition RuleCondition
Allocation RuleAllocation
Enabled bool
}
AllocationRule defines automatic allocation rules
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
Allocator manages team cost allocation
func (*Allocator) AddAllocationRule ¶
func (a *Allocator) AddAllocationRule(rule AllocationRule) error
AddAllocationRule adds an automatic allocation rule
func (*Allocator) AllocateCost ¶
func (a *Allocator) AllocateCost(teamID string, amount float64, source CostSource, description string, tags map[string]string) (*Allocation, error)
AllocateCost allocates a cost to a team
func (*Allocator) ApplyAllocationRules ¶
func (a *Allocator) ApplyAllocationRules(source CostSource, amount float64, tags map[string]string) ([]*Allocation, error)
ApplyAllocationRules applies automatic allocation rules to a cost
func (*Allocator) CreateTeam ¶
CreateTeam creates a new team
func (*Allocator) DeleteTeam ¶
DeleteTeam deletes a team
func (*Allocator) GenerateReport ¶
func (a *Allocator) GenerateReport(period AllocationPeriod) *Report
GenerateReport generates a cost report
func (*Allocator) GetTeamCosts ¶
func (a *Allocator) GetTeamCosts(teamID string) (*CostSummary, error)
GetTeamCosts returns cost summary for a team
func (*Allocator) RemoveMember ¶
RemoveMember removes a member from a team
func (*Allocator) UpdateTeam ¶
func (a *Allocator) UpdateTeam(id string, updates TeamUpdates) error
UpdateTeam updates a team
type Budget ¶
type Budget struct {
MonthlyLimit float64
YearlyLimit float64
AlertThreshold float64
CurrentSpend float64
}
Budget defines team budget
type CostBreakdown ¶
type CostBreakdown struct {
ByService map[string]float64
ByModel map[string]float64
ByFeature map[string]float64
ByDay map[string]float64
}
CostBreakdown breaks down costs by category
type CostItem ¶
type CostItem struct {
Source CostSource
Amount float64
Percentage float64
Date time.Time
}
CostItem represents a single cost item
type CostSource ¶
CostSource identifies where costs originated
type CostSummary ¶
type CostSummary struct {
TotalSpend float64
ThisMonth float64
ThisYear float64
ProjectedMonthly float64
ProjectedYearly float64
LastMonth float64
Trend float64
Breakdown CostBreakdown
}
CostSummary holds aggregated cost information
type Report ¶
type Report struct {
Period AllocationPeriod
GeneratedAt time.Time
Teams []TeamReport
Summary ReportSummary
Trends Trends
}
Report generates cost reports
type ReportSummary ¶
type ReportSummary struct {
TotalBudget float64
TotalSpend float64
TotalVariance float64
UtilizationRate float64
TeamCount int
OverBudgetTeams int
UnderBudgetTeams int
}
ReportSummary provides aggregate report data
type RuleAllocation ¶
RuleAllocation defines how to allocate costs
type RuleCondition ¶
RuleCondition defines when to apply a rule
type Team ¶
type Team struct {
ID string
Name string
Description string
Members []string
Budget Budget
Costs CostSummary
Metadata map[string]string
CreatedAt time.Time
UpdatedAt time.Time
}
Team represents a team with cost tracking
type TeamReport ¶
type TeamReport struct {
TeamID string
TeamName string
Budget Budget
ActualSpend float64
Variance float64
VariancePct float64
Breakdown CostBreakdown
TopCosts []CostItem
}
TeamReport holds a team's cost report
type TeamUpdates ¶
TeamUpdates holds team update fields