teamcosts

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package teamcosts provides team cost allocation capabilities for TokMan

Index

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

type AllocationPeriod struct {
	Start time.Time
	End   time.Time
}

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 NewAllocator

func NewAllocator() *Allocator

NewAllocator creates a team cost allocator

func (*Allocator) AddAllocationRule

func (a *Allocator) AddAllocationRule(rule AllocationRule) error

AddAllocationRule adds an automatic allocation rule

func (*Allocator) AddMember

func (a *Allocator) AddMember(teamID, userID string) error

AddMember adds a member to a team

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

func (a *Allocator) CreateTeam(name, description string, budget Budget) (*Team, error)

CreateTeam creates a new team

func (*Allocator) DeleteTeam

func (a *Allocator) DeleteTeam(id string) error

DeleteTeam deletes a team

func (*Allocator) GenerateReport

func (a *Allocator) GenerateReport(period AllocationPeriod) *Report

GenerateReport generates a cost report

func (*Allocator) GetTeam

func (a *Allocator) GetTeam(id string) (*Team, error)

GetTeam returns a team by ID

func (*Allocator) GetTeamCosts

func (a *Allocator) GetTeamCosts(teamID string) (*CostSummary, error)

GetTeamCosts returns cost summary for a team

func (*Allocator) ListTeams

func (a *Allocator) ListTeams() []*Team

ListTeams returns all teams

func (*Allocator) RemoveMember

func (a *Allocator) RemoveMember(teamID, userID string) error

RemoveMember removes a member from a team

func (*Allocator) SetBudget

func (a *Allocator) SetBudget(teamID string, budget Budget) error

SetBudget sets a team's budget

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

type CostSource struct {
	Type     string
	ID       string
	Name     string
	Category string
}

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

type RuleAllocation struct {
	TeamID      string
	Percentage  float64
	FixedAmount *float64
}

RuleAllocation defines how to allocate costs

type RuleCondition

type RuleCondition struct {
	SourceType string
	SourceID   string
	Tags       map[string]string
}

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

type TeamUpdates struct {
	Name        string
	Description string
	Budget      Budget
}

TeamUpdates holds team update fields

type Trends struct {
	DailyGrowthRate   float64
	WeeklyGrowthRate  float64
	MonthlyGrowthRate float64
	SeasonalFactor    float64
}

Trends captures spending trends

Jump to

Keyboard shortcuts

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